Skip to content

fs.rename() not being "redirected" correctly #332

Description

@jahilldev

Hi there,

First of all, many thanks for such a great package!

I've encountered an issue with the rename() function that's returned via the link function. All of the other file system methods are working correctly, however, this one does not seem to maintain the path redirect.

For example:

const { link } = require('linkfs');
const fs = require('fs');

const linkedFs = link(fs, [[`${__dirname}/test`, `${__dirname}/dist`]]);

linkedFs.ReadStream = fs.ReadStream;
linkedFs.WriteStream = fs.WriteStream;

/* ---------------------------
 *
 * Correctly loads `./dist/package.json`
 * 
 * ------------------------ */

console.log(linkedFs.readFileSync('./test/package.json', 'utf8'));

/* ---------------------------
 *
 * Incorrectly renames file to `./test/package-test.json` instead of `./dist/package-test.json`
 * 
 * ------------------------ */

linkedFs.rename('./test/package.json', './dist/package-test.json', () => console.log('COPIED'));

Do you have any idea why this might be?

Many thanks for any help in advance, very much appreciated!

All the best

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions