Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports.writeFilesystem = function (dest, filesystem, files, metadata, callback) {
let sizeBuf
let headerBuf
try {
const headerPickle = pickle.createEmpty()
headerPickle.writeString(JSON.stringify(filesystem.header))
headerBuf = headerPickle.toBuffer()
const sizePickle = pickle.createEmpty()
sizePickle.writeUInt32(headerBuf.length)
sizeBuf = sizePickle.toBuffer()
} catch (error) {
return callback(error)
}
const out = fs.createWriteStream(dest)
out.on('error', callback)
out.write(sizeBuf)
return out.write(headerBuf, function () {
return writeFileListToStream(dest, filesystem, out, files, metadata, callback)
})
}
module.exports.writeFilesystem = function (dest, filesystem, files, metadata, callback) {
let sizeBuf
let headerBuf
try {
const headerPickle = pickle.createEmpty()
headerPickle.writeString(JSON.stringify(filesystem.header))
headerBuf = headerPickle.toBuffer()
const sizePickle = pickle.createEmpty()
sizePickle.writeUInt32(headerBuf.length)
sizeBuf = sizePickle.toBuffer()
} catch (error) {
return callback(error)
}
const out = fs.createWriteStream(dest)
out.on('error', callback)
out.write(sizeBuf)
return out.write(headerBuf, function () {
return writeFileListToStream(dest, filesystem, out, files, metadata, callback)
})
}
private writeAsarFile(): Promise {
const headerPickle = pickle.createEmpty()
headerPickle.writeString(JSON.stringify(this.fs.header))
const headerBuf = headerPickle.toBuffer()
const sizePickle = pickle.createEmpty()
sizePickle.writeUInt32(headerBuf.length)
const sizeBuf = sizePickle.toBuffer()
const writeStream = createWriteStream(this.outFile)
return new BluebirdPromise((resolve, reject) => {
writeStream.on("error", reject)
writeStream.once("finish", resolve)
writeStream.write(sizeBuf)
let w: (list: Array, index: number) => void
w = (list: Array, index: number) => {
if (list.length === index) {
writeStream.end()
return
}
module.exports.writeFilesystem = function (dest, filesystem, files, metadata, callback) {
let sizeBuf
let headerBuf
try {
const headerPickle = pickle.createEmpty()
headerPickle.writeString(JSON.stringify(filesystem.header))
headerBuf = headerPickle.toBuffer()
const sizePickle = pickle.createEmpty()
sizePickle.writeUInt32(headerBuf.length)
sizeBuf = sizePickle.toBuffer()
} catch (error) {
return callback(error)
}
const out = fs.createWriteStream(dest)
out.on('error', callback)
out.write(sizeBuf)
return out.write(headerBuf, function () {
return writeFileListToStream(dest, filesystem, out, files, metadata, callback)
})
module.exports.writeFilesystem = function(dest, filesystem, files, cb) {
var headerPickle = pickle.createEmpty();
headerPickle.writeString(JSON.stringify(filesystem.header));
var headerBuf = headerPickle.toBuffer();
var sizePickle = pickle.createEmpty();
sizePickle.writeUInt32(headerBuf.length);
var sizeBuf = sizePickle.toBuffer();
var out = fs.createWriteStream(dest);
out.write(sizeBuf);
out.write(headerBuf, writeFileListToStream.bind(this, dest, filesystem, out, files, cb));
};
module.exports.writeFilesystem = function(dest, filesystem, files, cb) {
var headerPickle = pickle.createEmpty();
headerPickle.writeString(JSON.stringify(filesystem.header));
var headerBuf = headerPickle.toBuffer();
var sizePickle = pickle.createEmpty();
sizePickle.writeUInt32(headerBuf.length);
var sizeBuf = sizePickle.toBuffer();
var out = fs.createWriteStream(dest);
out.write(sizeBuf);
out.write(headerBuf, writeFileListToStream.bind(this, dest, filesystem, out, files, cb));
};
return new Promise((resolve, reject) => {
const headerPickle = pickle.createEmpty()
headerPickle.writeString(JSON.stringify(this.fs.header))
const headerBuf = headerPickle.toBuffer()
const sizePickle = pickle.createEmpty()
sizePickle.writeUInt32(headerBuf.length)
const sizeBuf = sizePickle.toBuffer()
const writeStream = createWriteStream(this.outFile)
writeStream.on("error", reject)
writeStream.on("close", resolve)
writeStream.write(sizeBuf)
let fileSetIndex = 0
let files = fileSets[0].files
let metadata = fileSets[0].metadata
module.exports.writeFilesystem = async function (dest, filesystem, files, metadata) {
const headerPickle = pickle.createEmpty()
headerPickle.writeString(JSON.stringify(filesystem.header))
const headerBuf = headerPickle.toBuffer()
const sizePickle = pickle.createEmpty()
sizePickle.writeUInt32(headerBuf.length)
const sizeBuf = sizePickle.toBuffer()
const out = fs.createWriteStream(dest)
await new Promise((resolve, reject) => {
out.on('error', reject)
out.write(sizeBuf)
return out.write(headerBuf, () => resolve())
})
return writeFileListToStream(dest, filesystem, out, files, metadata)
}
module.exports.writeFilesystem = function (dest, filesystem, files, metadata, callback) {
let sizeBuf
let headerBuf
try {
const headerPickle = pickle.createEmpty()
headerPickle.writeString(JSON.stringify(filesystem.header))
headerBuf = headerPickle.toBuffer()
const sizePickle = pickle.createEmpty()
sizePickle.writeUInt32(headerBuf.length)
sizeBuf = sizePickle.toBuffer()
} catch (error) {
return callback(error)
}
const out = fs.createWriteStream(dest)
out.on('error', callback)
out.write(sizeBuf)
return out.write(headerBuf, function () {
return writeFileListToStream(dest, filesystem, out, files, metadata, callback)
})
private writeAsarFile(): Promise {
const headerPickle = pickle.createEmpty()
headerPickle.writeString(JSON.stringify(this.fs.header))
const headerBuf = headerPickle.toBuffer()
const sizePickle = pickle.createEmpty()
sizePickle.writeUInt32(headerBuf.length)
const sizeBuf = sizePickle.toBuffer()
const writeStream = createWriteStream(this.outFile)
return new BluebirdPromise((resolve, reject) => {
writeStream.on("error", reject)
writeStream.once("finish", resolve)
writeStream.write(sizeBuf)
let w: (list: Array, index: number) => void
w = (list: Array, index: number) => {
if (list.length === index) {