Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appendFile with mixin node.js fs + memfs #181

Open
bluelovers opened this issue Sep 22, 2018 · 1 comment
Open

appendFile with mixin node.js fs + memfs #181

bluelovers opened this issue Sep 22, 2018 · 1 comment

Comments

@bluelovers
Copy link

real file

../test/456 => 999999999999999\n

=========

import { fs as memfs, vol, Volume, createFsFromVolume, IFs } from 'memfs';
import { ufs } from 'unionfs';
import * as fsNode from 'fs';

let vol2 = Volume.fromJSON({
	'../test': null,
}, );

let memfs2 = createFsFromVolume(vol2);

export const fs: IFs = ufs
	.use(fsNode)
	.use(memfs2)
;

console.log(1, fs.readFileSync('../test/456').toString());

fs.appendFileSync('../test/456', '123');

console.log(2, fs.readFileSync('../test/456').toString());

expect is 999999999999999\n123 but got 123 only at step 2

@iamogbz
Copy link

iamogbz commented Apr 10, 2020

@bluelovers swapping the order of the use

export const fs: IFs = ufs
	.use(memfs2)
	.use(fsNode)

or removing the fake mem directory

let vol2 = Volume.fromJSON({});

works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants