Skip to content

fs cannot read out of .asar archive #1450

@amenders

Description

@amenders
  • Node.js Version: 8.11.3
  • OS: Windows 10
  • Scope (install, code, runtime, meta, other?): code
  • Module (and version) (if relevant): File System

I am trying to read files out of a .asar archive using readdirSync, and am having trouble. Attempting to read out of the archive returns this error:

Error: ENOTDIR: not a directory, scandir 'C:\Users\xxxx\Desktop\xxxxxx\xxxxxx\dist\win-unpacked\resources\app.asar'
    at Object.fs.readdirSync (fs.js:904:18)

Code to reproduce:

var fs = require('fs');
fs.readdirSync('C:/path/to/app.asar');

For context, this is the app.asar file from my electron-builder output, but I expected that fs would allow me to read the contents of the archive. I've also tried constructing the path with path.join(...) but that did not make a difference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions