Skip to content
This repository was archived by the owner on May 23, 2021. It is now read-only.

Commit 2436ee5

Browse files
committed
Convert to buffer when bundling for convenience
1 parent 637592d commit 2436ee5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/api/bundler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class Binary implements nbin.Binary {
1515

1616
public constructor(private readonly options: nbin.BinaryOptions) {}
1717

18-
public writeFile(pathName: string, content: Buffer): void {
18+
public writeFile(pathName: string, content: Buffer | string): void {
1919
const parts = path
2020
.normalize(pathName)
2121
.split(path.sep)
@@ -24,7 +24,7 @@ export class Binary implements nbin.Binary {
2424
for (let i = 0; i < parts.length; i++) {
2525
const part = parts[i]
2626
if (i === parts.length - 1) {
27-
writableFs.write(part, content)
27+
writableFs.write(part, typeof content === "string" ? Buffer.from(content) : content)
2828
} else {
2929
writableFs = writableFs.cd(part)
3030
}
@@ -128,7 +128,7 @@ export class Binary implements nbin.Binary {
128128
}
129129

130130
private async cacheBinary(): Promise<Buffer> {
131-
let nodeBinaryPath = this.options.nodePath || path.join(__dirname, "../../lib/node/out/Release/node")
131+
let nodeBinaryPath = this.options.nodePath || path.join(__dirname, "../../lib/node/node")
132132
const nodeBinaryName = this.nodeBinaryName
133133

134134
// By default we use the locally compiled node. If that or the provided Node

0 commit comments

Comments
 (0)