Code Monkey home page Code Monkey logo

Comments (5)

manidlou avatar manidlou commented on May 27, 2024

@rasq according to electron docs, node APIs treat asar archives as directories. What is the exact problem that you are facing?

from node-klaw-sync.

rasq avatar rasq commented on May 27, 2024

It will be good to have option to set archives as files for klaw.
Why?
Because sometimes someone will use a files/directories list from klaw and he/she will might to use it for some reason, maybe to create list for software that will check each file, on for archive tool, or maybe to create MSI package. On this cases files from archive are not accesible but they are listed, and error will occure.
I'am having some simillar problem, im generating xml for WixToolset using electron and klaw. And .asar archive are problems, (i need only have file path to .asar, not path to asar and files inside).

from node-klaw-sync.

Geelik avatar Geelik commented on May 27, 2024

Hey, late response but now you can filter out directories when traversing. You can look at this test to see how you can do it.

from node-klaw-sync.

markmorris avatar markmorris commented on May 27, 2024

Im facing this exact problem right now. Treating .asar as directory is a killer when trying to create an MSI package using wix. Would be nice to have a clear example of how to treat them like files.

Current Code from electron-wix-msi (https://github.com/felixrieseberg/electron-wix-msi)

function getDirectoryStructure(root) {
return new Promise((resolve, reject) => {
if (!fs.existsSync(root)) {
return reject(new Error(App directory ${root} does not exist));
}
const files = [];
const directories = [];
klaw(root, { })
.on('data', (item) => {
if (item.stats.isFile()) {
files.push(item.path);
}
else if (item.stats.isDirectory() && item.path !== root) {
directories.push(item.path);
}
})
.on('end', () => resolve({ files, directories }));
});
}

from node-klaw-sync.

manidlou avatar manidlou commented on May 27, 2024

@markmorris your code uses klaw and not klaw-sync. I'd recommend to open an issue there!

from node-klaw-sync.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.