
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Enable require('./path/to/any-node-project.asar') & require('./path/to/any-node-project.asar/any/file'). Or just run asar-node ./path/to/any-node-project.asar
Enable require('./path/to/any-node-project.asar')
& require('./path/to/any-node-project.asar/any/file')
in your nodejs app.
$ npm install -g asar-node
$ asar-node ./path/to/any-node-project
$ asar-node ./path/to/any-node-project.asar
$ asar-node ./path/to/any-node-project.asar/any/file
$ asar-node ./path/to/any-node-project.asar/any/file.js
$ asar-node ./path/to/any-node-project.asar/any/file.json
$ asar-node ./path/to/any-node-project.asar/any/file.node
$ npm install asar-node
require('asar-node').register()
// Equivalent to require('asar-node/lib/register.js').register()
require('./path/to/any-node-project') // like require a nodejs directory
// or require('./path/to/any-node-project.asar')
require('./path/to/any-node-project.asar/any/file')
If require a asar file, make sure there is package.json
and main
field or index.js
/ index.json
/ index.node
in the asar root.
You can also pack node_modules
into node_modules.asar
instead of packing the hole project folder into an asar file.
To let node find modules from node_modules.asar
, You should
const { register, addAsarToLookupPaths } = require('asar-node')
// Equivalent to
// const register = require('asar-node/lib/register.js').register
// const addAsarToLookupPaths = require('asar-node/lib/lookup.js').addAsarToLookupPaths
register()
addAsarToLookupPaths()
const Koa = require('koa') // koa is in node_modules.asar
In an electron project, it's unnecessary to call register()
but you can also call addAsarToLookupPaths()
to enable node_modules.asar
support.
To disable asar support, you can set process.noAsar = true
or ELECTRON_NO_ASAR
environmnet variable.
v1.x
require('asar-node')
v2.x / v3.x
require('asar-node/lib/autorun/index')
node_modules/asar-node/dist/index.js
Library bundle.
const {
register,
addAsarToLookupPaths
} = require('asar-node/dist/index.js')
// Equivalent to require('asar-node')
node_modules/asar-node/dist/asar-node.js
CLI bundle.
$ node ./node_modules/asar-node/dist/asar-node.js [...]
# Equivalent to
$ asar-node [...]
node_modules/asar-node/dist/autorun.js
Preload bundle.
$ node -r ./node_modules/asar-node/dist/autorun.js [...]
require('asar-node/dist/autorun.js')
require('./path/to/app.asar/index.js')
// app.asar/index.js
require('mod') // mod could be in node_modules.asar
node_modules/asar-node/dist/autorun-register.js
Preload bundle without node_modules.asar
support.
$ node -r ./node_modules/asar-node/dist/autorun-register.js [...]
require('asar-node/dist/autorun-register.js')
require('./path/to/app.asar/index.js')
// app.asar/index.js
require('mod') // throws error if mod is in node_modules.asar
node_modules/asar-node/dist/autorun-lookup.js
Preload bundle with node_modules.asar
support only, useful for electron environment.
// webpack electron target
import 'asar-node/dist/autorun-lookup.js' // 1KB minified
require('original-fs')
fs.readFileSync
/ fs.readFile
/ fs.promises.readFile
fs.statSync
/ fs.stat
/ fs.promises.stat
fs.lstatSync
/ fs.lstat
/ fs.promises.lstat
fs.readdirSync
/ fs.readdir
/ fs.promises.readdir
fs.existsSync
/ fs.exists
fs.accessSync
/ fs.access
/ fs.promises.access
fs.realpathSync
/ fs.realpath
/ fs.realpathSync.native
/ fs.realpath.native
/ fs.promises.realpath
fs.copyFileSync
/ fs.copyFile
/ fs.promises.copyFile
fs.openSync
/ fs.open
/ fs.promises.open
fs.createReadStream
child_process.execFile
child_process.execFileSync
--unpack=*.node
to asar CLIFAQs
Enable require('./path/to/any-node-project.asar') & require('./path/to/any-node-project.asar/any/file'). Or just run asar-node ./path/to/any-node-project.asar
We found that asar-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.