Comments (12)
going to need a code sample and environment information. there are tests for such things which all currently pass.
from node-archiver.
os x 10.9. Just try append some empty files to tar archive.
On 9 November 2013 03:31, Chris Talkington [email protected] wrote:
going to need a code sample and environment information. there are tests
for such things which all currently pass.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/49#issuecomment-28106912
.
from node-archiver.
sorry, i don't have a mac to test on.
what version of node? archiver? how are you adding the file (stream or buffer)? if stream, what kind legacy or stream2?
from node-archiver.
I'll be more helpful than that guy!
Mac OS X 10.7
Node 10.22
Archiver 0.5.0-alpha
var archive = archiver('tar');
archive.pipe(res); // I'm in Express
archive.append(fs.createReadStream(path.resolve("path", "to", "emptyFile.txt")), { name: "empty.txt" });
res.set('Content-Disposition', 'attachment; filename=empty.txt');
archive.finalize();
Fails silently without throwing an error (the finalize()
callback is never invoked, and archive.on('error')
is not invoked either.
from node-archiver.
wouldn't you set content-disp before pipe? as it could be sending data before you define what it is?
from node-archiver.
hum, i think the test has multiple appends, maybe the first one kick starts the thing and single doesn't. will have to play with it next time im editing things.
from node-archiver.
I had assumed that nothing was actually sent until finalize() was called, since it seemed to work fine. I moved the Content-Disposition setter but it had no effect on the output, it seems.
My actual code does do multiple appends, which doesn't work either, unfortunately. The empty file is the last file appended-- I tried changing the order so that the empty file came first, and that didn't change anything.
The actual code in my app:
files.forEach(function(f) {
archive.append(fs.createReadStream(path.resolve(CONTENT_DIR, f)), { name: f });
});
from node-archiver.
Unrelated: this is the best, easiest node package for tarring and zipping out there, thanks :)
from node-archiver.
you could actually use file
now too with latest alpha. let it handle the stream creating for you.
from node-archiver.
glad you like the package. v0.5 is going to really redefine the internals of it all with tar and zip logic being switched to modules internally. zip-stream
and tar-stream
will be integrated in the coming weeks which should allow for quick targeted fixes to output related issues without need to update archiver itself.
from node-archiver.
So using .file()
actually works, and the zero-byte file is included correctly!
from node-archiver.
ah so my guess is that stream emits before archiver can handle it.
from node-archiver.
Related Issues (20)
- 压缩后文件的修改时间不正确
- achiver.directory can't use, error with input source must be valid Stream or Buffer instance error HOT 1
- How to zip single file HOT 1
- Dependency Dashboard
- ESM HOT 1
- .directory() generate a empty folder, compress completed will remove the empty folder,could I retain the empty folder?
- Class extends value undefined is not a constructor or null HOT 1
- Is there a way to know how many files were ultimately compressed? HOT 2
- Question: Were there any API changes from 5.3 to 6.x? HOT 1
- Recommendation for an unzip library? HOT 1
- Overwrite existing files
- Missing Release of Resource after Effective Lifetime [High Severity] HOT 1
- zlib level 0 stops the progress of ongoing read streams
- 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
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.