Comments (11)
you can now use the following in v0.8.0
:
archive.append(null, { name: 'directory/' });
from node-archiver.
you can now use the following in
v0.8.0
:archive.append(null, { name: 'directory/' });how to fill content into 'directory/ ?
The 2nd parameter of directory() and the name attribute in the 2nd param of append() can take file path as inputs.
archive.directory('.../yourfolder', 'directory/yourfoler');
archive.append(fs.createReadStream('.../yourfile'), { name: 'directory/yourfile' });
from node-archiver.
you would need to create an empty file with the path. something like..
archive.append('', { name: 'my/new/dir/.keep' });
from node-archiver.
Thanks! Also is there a way to point at a directory that exists on the file system and have it add that directory full of files to the archive?
Basically this is the only module that I have found that supports streaming dynamically created content as a zip file. However I do also have a few 'static' directories (stuff that exists on the server) that I would like to include in the zip.
from node-archiver.
not at this point in time, mainly because this module was created to assist a grunt task which already handles the file globbing and such. so it was never a key feature, however the audience has grown so it may be considered in a near future version.
from node-archiver.
I'd definitely need a way how to create empty folders in archives. Have been playing around with tar-stream
module which does it by passing a type
prop into header object:
var tar = require('tar-stream');
var pack = tar.pack();
pack.entry({ name: 'Dirname', type: 'directory' }, callback);
Would it be possible to support something like that?
Also, I've read in one of the issues that you are planning on adding a .directory()
method, but that it will be used to bulk-add files from that particular directory. Is it necessary when you already have .bulk()
? Couldn't you just modify it to add files from a directory when string is passed? Wouldn't it be more correct for .directory()
to add an empty directory? You know like:
.file()
- adds a file.directory()
- adds a directory
from node-archiver.
thanks for the feedback. directory
was originally bulk
but was renamed to make bit more sense. so i could actually make directory
do what you mention.
v0.5 is going to contain quite a bit of change. tar archive building will be a wrapper around tar-stream
to combine efforts as soon as I get a few PRs committed over there. ill likely split the core zip logic into its own published module soon too. my end goal is have to v0.5 out by the end of Jan.
from node-archiver.
archive.append(null, { name: 'directory/' });
Does this still work in the latest versions of node-archiver
? I see directory was refactored in 2.1.0
.
from node-archiver.
@ltomes Yes. It works with 3.0.0
.
from node-archiver.
you can now use the following in
v0.8.0
:archive.append(null, { name: 'directory/' });
how to fill content into 'directory/ ?
from node-archiver.
in version 7.0.1, use null create empty file inside the folder
from node-archiver.
Related Issues (20)
- Improve docs around append callback? HOT 1
- How to convert csv to 7z HOT 1
- Heap out of memory with archiver.append() HOT 1
- Append CSV file line by line
- `append()` fails after upgrading from v6 to v7 HOT 4
- Cannot add file named `\` HOT 2
- Archiver Version 7.0 might be breaking due to ESM HOT 1
- [Question] Can this library work with Web Streams ?
- Create a single zip file incrementally? HOT 2
- Produce the same zip file all time HOT 1
- Zip file produced has 0 bytes HOT 2
- ZIP consume all memory and return null from lambda function response
- docs should warn loudly that archiver doesn't use bonafide Node streams
- Corrupted zip file, created using data event from archiver
- Question: should `.finalize` be awaited? HOT 2
- Use node:-prefixed imports for Node.js core modules
- Extended Attributes Support
- archive hash signature
- Local file header properties
- Simple archive is very verbose
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-archiver.