Creating .asar from files throws error

I’m clueless why asar.createPackageFromFiles() keeps throwing an error.

Minimum Viable Example:

import { createPackageFromFiles } from 'asar';

const src = '/Users/idleberg/test';
const dest = '/Users/idleberg/test.asar';
const filenames = ["", "package.json"];

try {
    await createPackageFromFiles(src, dest, filenames);
  } catch (error) {

To my understanding, all parameters are passed as required, but it keeps throwing this error:

Error: ENOENT: no such file or directory, lstat ''

All files are present in src, so I have no clue why this wouldn’t work.

I’ve found the answer: contrary to the description of createPackageFromFiles(), the file argument does not take a path relative to the first argument. It only takes absolute paths :unamused:

1 Like