Reputation: 11
I am a very beginner in nodeJS, so I can't succeed with the examples of the 'node-7z' package that I find on rpm repository.
In fact I just want to make a .7z file from a Access database (.accdb file), but I can't find to write the node-7z stream on my hard drive.
So I use this code, can you help, just to write it ?
thank you very much
var Seven = require("node-7z")
let fileentree = 'D:/Users/F/Dev/NodeJS/Sauvegardes7Zip_NodeJS/Database.accdb'
let filecompressee = 'D:/Users/F/Dev/NodeJS/Sauvegardes7Zip_NodeJS/Archive.7z'
let path7zip = 'C:/Program Files/7-Zip/7z.exe'
// myStream is an Readable stream
const myStream = Seven.add(filecompressee,fileentree, {
$bin: path7zip,
y: true,
ssw: true
});
Upvotes: 1
Views: 710
Reputation: 898
Use fs.createWriteStream:
const fs = require('fs');
const myStream = ...
const writeStream = fs.createWriteStream('path/to/my/disk/file');
myStream.pipe(writeStream);
Upvotes: 1