Skip to content

Commit

Permalink
fix: chmod on load in Nodejs
Browse files Browse the repository at this point in the history
Npm doesn't seem to preserve the permissions
  • Loading branch information
aminya committed Sep 7, 2024
1 parent ece171c commit ca65e23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aminya/minijson",
"version": "1.0.1",
"version": "1.0.2",
"description": "Minify JSON files blazing fast! Supports Comments. Uses D, C, and AVX2 and SSE4_1 SIMD",
"homepage": "https://github.com/aminya/minijson",
"license": "MIT",
Expand Down
6 changes: 6 additions & 0 deletions src/node/lib.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { execFile } from "child_process"
import { chmodSync } from "fs"
import { readFile, writeFile } from "fs/promises"
import { join } from "path"

Expand Down Expand Up @@ -64,6 +65,11 @@ const binName = `minijson${exeExtention}`

const minijsonBin = join(__dirname, `${process.platform}-${process.arch}`, binName)

// chmod as executable on non-windows
if (process.platform !== "win32") {
chmodSync(minijsonBin, 0o755)
}

/**
* Spawn minijson with the given arguments
*
Expand Down

0 comments on commit ca65e23

Please sign in to comment.