Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve) => {
const stdout: asc.MemoryStream = asc.createMemoryStream();
const stderr: asc.MemoryStream = asc.createMemoryStream();
asc.main([
params.filepath,
'--binaryFile', 'binary',
...params.ascOptions
], {
stdout,
stderr,
readFile: (filename: string, baseDir: string) => {
const filenameWithoutTSExtension: string = filename.replace('.ts', '');
return fs.readFileSync(filenameWithoutTSExtension).toString();
},
writeFile: (filename: string, contents: Readonly) => {
resolve({
binary: contents,
return new Promise((resolve) => {
const stdout: asc.MemoryStream = asc.createMemoryStream();
const stderr: asc.MemoryStream = asc.createMemoryStream();
asc.main([
params.filepath,
'--binaryFile', 'binary',
...params.ascOptions
], {
stdout,
stderr,
readFile: (filename: string, baseDir: string) => {
const filenameWithoutTSExtension: string = filename.replace('.ts', '');
return fs.readFileSync(filenameWithoutTSExtension).toString();
},
writeFile: (filename: string, contents: Readonly) => {
resolve({
binary: contents,
stdout: stdout.toString(),