Skip to content

Under Node, openssl.js always uses the real filesystem instead of the provided one #4

@CyberShadow

Description

@CyberShadow
const openssl = require('./openssl.js/dist/openssl.cjs');
const path = require('path');
const fs = require('fs');

let fakeFs = {
  existsSync : () => true
};

var openSSL = new openssl.OpenSSL({ fs : fakeFs });

(async function () {
  // Fails with "No such file or directory", but fakeFs.openSync is never called
  await openSSL.runCommand('base64 -d -in /file.txt');

  fs.writeFileSync('file.txt', 'dGVzdAo=\n');
  // Prints the (base64-decoded) contents of the real file.txt
  await openSSL.runCommand('base64 -d -in ' + fs.realpathSync('file.txt'));
})();

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