Closed Jcanno closed 4 years ago
Example code needs to be updated, because fs.writeFile
requires callback now.
Try this:
const crx = new ChromeExtension({
privateKey: fs.readFileSync('./dist.pem')
});
crx.load( path.resolve(__dirname, 'dist') )
.then(crx => crx.pack())
.then(crxBuffer => {
fs.writeFile('myExtension.crx', crxBuffer, err => err ? console.error(err) : console.log('extension file written'));
})
.catch(err=>{
console.error( err );
});
or something like this:
const crx = new ChromeExtension({
privateKey: fs.readFileSync('./dist.pem')
});
crx.load( path.resolve(__dirname, 'dist') )
.then(crx => crx.pack())
.then(crxBuffer => fs.promises.writeFile('myExtension.crx', crxBuffer))
.catch(err=>{
console.error( err );
});
I just copy code of document and delete codebase option, use my correct path, but pack going error, how should I do?