Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there way to Stream to request instead of saving in directory? #57

Open
junaidcs opened this issue Apr 1, 2016 · 3 comments
Open

Comments

@junaidcs
Copy link

junaidcs commented Apr 1, 2016

There Please!

Is there a way to steam the created workbook directly to request, instead of saving to the directory first?

var workbook = excelbuilder.createWorkbook(DIRECTORY_PATH, 'file_name.xlsx');
...
 workbook.save(cb)

Answer is much appreciated!

@squirrelsRduck
Copy link

use 0.1.0 by linking directly to github, instead of npm. use generate function. im still figuring out how to get the file correctly, but this seems like it should work (it doesn't open correctly though on my Macintosh, still figuring things out):

     res.writeHead(200, {
                     'Content-Type': 'application/octet-stream',
                     'Content-Length': buffer.length,
                     'Content-Disposition': 'attachment; filename=acceptable.zip'
                   });
                   res.write(buffer);
                   res.end();

@junaidcs
Copy link
Author

Thanks for your reply, I've managed it saving first on drive upload to cloud then remove from drive :)

workbook.save(function (err) {
    if (!err) {      
      var stream = fs.createReadStream(tempDir + '/' + excelFileName);
      //code to upload to cloud
      fs.unlink(tempDir + '/' + excelFileName);
    }
});

@squirrelsRduck
Copy link

i cannot use the file system because i might host in a PAAS environment. however, i will try downloading the file using AJAX in browser, then use unzip it using same utility from this app, then use filesaver.js to present the file for saving, since regular html5 download + unzipper generates a folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants