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

fix: CreateOptions.transform should return stream #195

Merged
merged 3 commits into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type CreateOptions = {
globOptions?: GlobOptions;
ordering?: string;
pattern?: string;
transform?: (filePath: string) => string;
transform?: (filePath: string) => NodeJS.ReadWriteStream | void;
malept marked this conversation as resolved.
Show resolved Hide resolved
unpack?: string;
unpackDir?: string;
};
Expand Down
3 changes: 2 additions & 1 deletion test/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as asar from '..';
import * as fs from 'fs';
import * as crypto from 'crypto'
import { expectType } from 'tsd';

await asar.createPackage('bin', 'tmp/foo.asar');
Expand All @@ -8,7 +9,7 @@ await asar.createPackageWithOptions('bin', 'tmp/foo.asar', {
globOptions: {
debug: true,
},
transform: (filePath: string) => filePath.replace('/', ':'),
transform: (filePath: string) => crypto.createCipheriv('aes-256-cbc', crypto.randomBytes(32), crypto.randomBytes(16)).setAutoPadding(true).setEncoding('base64'),
});
await asar.createPackageFromFiles('bin', 'tmp/foo.asar', ['bin/asar.js']);
const stat = fs.statSync('bin/asar.js');
Expand Down