summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/_fs
AgeCommit message (Collapse)Author
2024-11-13feat(ext/fs): add ctime to Deno.stats and use it in node compat layer (#24801)Łukasz Czerniawski
This PR fixes #24453, by introducing a ctime (using ctime for UNIX and ChangeTime for Windows) to Deno.stats. Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-11-04chore: update dlint to v0.68.0 for internal (#26711)Kenta Moriuchi
2024-10-31fix(ext/node): convert errors from `fs.readFile/fs.readFileSync` to node ↵Nathan Whitaker
format (#26632) Fixes the original issue reported in #26404. storybook runs into other errors after this PR (the new errors will be fixed in other PRs). Some code used by a dependency of storybook does a [string comparison on the error message](https://github.com/chromaui/chromatic-cli/blob/ce30b2be343cb96a0826390b95ea42befb2be547/node-src/lib/getConfiguration.ts#L88-L92) thrown here to check for a file not found error.
2024-10-27fix(ext/node): add path to `fs.stat` and `fs.statSync` error (#26037)familyboat
2024-10-18fix(ext/node): properly map reparse point error in readlink (#26375)Nathan Whitaker
2024-10-17fix(node/fs): copyFile with `COPYFILE_EXCL` should not throw if the ↵Nathan Whitaker
destination doesn't exist (#26360) Fixes #26313. We were checking for the NotFound error, but still calling the callback with the error / throwing.
2024-10-08fix(ext/node): internal buffer length in readSync (#26064)Satya Rohith
Closes https://github.com/denoland/deno/issues/26054
2024-09-18Revert "feat(fmt): sort type-only named import/exports last" (#25705)David Sherret
Reverts #25690 This was not an issue with the ts compiler anymore. Discussion here: https://github.com/dprint/dprint-plugin-typescript/pull/664#issuecomment-2357000053
2024-09-17feat(fmt): sort type-only named import/exports last (#25690)David Sherret
Closes #22583
2024-09-11fix(ext/node): add `FileHandle#writeFile` (#25555)Yoshiya Hinosawa
This PR adds `writeFile` methods of `FileHandle` class https://nodejs.org/api/fs.html#filehandlewritefiledata-options
2024-09-11fix(ext/node): Add missing node:fs and node:constants exports (#25568)Nathan Whitaker
Just a bunch of random fs constants
2024-09-05BREAKING(fs): remove `Deno.seek[Sync]()` (#25449)Asher Gomez
Towards #22079
2024-08-16fix(node/fs): Use correct offset and length in node:fs.read and write (#25049)Nathan Whitaker
My fix in #25030 was buggy, I forgot to pass the `byteOffset` and `byteLength`. Whoops. I also discovered that fs.read was not respecting the `offset` argument, and we were constructing a new `Buffer` for the callback instead of just passing the original one (which is what node does, and the @types/node definitions also indicate the callback should get the same type). Fixes #25028.
2024-08-14fix(node/fs): node:fs.read and write should accept typed arrays other than ↵Nathan Whitaker
Uint8Array (#25030) Part of #25028. Our underlying read/write operations in `io` assume the buffer is a Uint8Array, but we were passing in other typed arrays (in the case above it was `Int8Array`).
2024-08-12chore: update the copyright of c, mjs, and jsx (#25005)Kenta Moriuchi
2024-08-07fix: `rename` watch event missing (#24893)Marvin Hagemeister
This PR ensures that we forward a `rename` event in our file watcher. The rust lib we use combines that with the `modify` event. This fixes a compatibility issue with Node too, which sends the `rename` event as well. Fixes https://github.com/denoland/deno/issues/24880
2024-07-31fix(node/fs/promises): watch should be async iterable (#24805)Marvin Hagemeister
The way `fs.watch` works is different in `node:fs/promises` than `node:fs`. It has a different function signature and it returns an async iterable instead, see https://nodejs.org/api/fs.html#fspromiseswatchfilename-options Fixes https://github.com/denoland/deno/issues/24661
2024-07-17perf(ext/node): optimize fs.exists[Sync] (#24613)Divy Srivastava
Use `access` on *nix and `GetFileAttributesW` on Windows. [Benchmark](https://paste.divy.work/p/-gq8Ark.js): ``` $ deno run -A bench.mjs # main (568dd) existsSync: 8980.636629ms $ target/release/deno run -A bench.mjs # this PR existsSync: 6448.7604519999995ms $ bun bench.mjs existsSync: 6562.88671ms $ node bench.mjs existsSync: 7740.064653ms ``` Ref https://github.com/denoland/deno/pull/24434#discussion_r1679777912
2024-07-05fix(node): Implement `fs.lchown` (and `process.getegid`) (#24418)Nathan Whitaker
Closes https://github.com/denoland/deno/issues/21260. Part of https://github.com/denoland/deno/issues/18218. Implements `node:fs.lchown`, and enables the node_compat test for it. The test uses `process.getegid`, which we didn't have implemented, so I went ahead and implemented that as well to get the test working.
2024-07-04fix: revert accidentally added `parentPath` on `DirEntry` (#24438)David Sherret
Reverts the accidentally added `.parentPath` on dir entries in https://github.com/denoland/deno/pull/24257/files This should not have been added to the public api and is not documented.
2024-07-02fix(ext/node): Add `fs.lutimes` / `fs.lutimesSync` (#23172)Nathan Whitaker
Part of #18218 - Adds `fs.lutimes` and `fs.lutimesSync` to our node polyfills. To do this I added methods to the `FileSystem` trait + ops to expose the functionality to JS. - Exports `fs._toUnixTimestamp`. Node exposes an internal util `toUnixTimestamp` from the fs module to be used by unit tests (so we need it for the unit test to pass unmodified). It's weird because it's only supposed to be used internally but it's still publicly accessible - Matches up error handling and timestamp handling for fs.futimes and fs.utimes with node - Enables the node_compat utimes test - this exercises futimes, lutimes, and utimes.
2024-06-24fix(ext/node): use primordials in `ext/node/polyfills/_fs/_fs_dir.ts` (#24319)Asher Gomez
Towards #24236 --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com> Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-06-24fix(ext/node): use primordials in `ext/node/polyfills/_fs/_fs_cp.js` (#24320)Asher Gomez
Towards #24236
2024-06-19fix(ext/node): Add Dirent.path and Dirent.parentPath (#24257)Divy Srivastava
2024-06-11chore: sync up Node.js test files for v20.11.1 (#24066)Bartek Iwańczuk
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-05-28fix(ext/node): add `throwIfNoEntry` option in `fs.lstatSync` (#24006)Marvin Hagemeister
We didn't support the `throwIfNoEntry` option for Node's `fs.lstatSync` method. Note that the async variant doesn't have this option. Fixes https://github.com/denoland/deno/issues/23996
2024-04-01fix(ext/node): Add fs.readv, fs.readvSync (#23166)Nathan Whitaker
Part of #18218. Implements `fs.readv` and `fs.readvSync` and enables the corresponding `node_compat` tests.
2024-03-20fix(ext/node): FsWatcher ref and unref (#22987)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/22973 --------- Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-03-16fix(ext/node): pass normalized watchFile handler to StatWatcher (#22940)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/22939
2024-03-13feat(node): implement fs.statfs() (#22862)Nayeem Rahman
2024-03-09fix(ext/node): support junction symlinks on Windows (#22762)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/20609 Vitepress support! `vitepress dev` and `vitepress build` via BYONM
2024-03-06fix(ext/node): add default methods to fs.StatsBase (#22750)Divy Srivastava
2024-03-06fix(node): stat/statSync returns instance of fs.Stats (#22294)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/22291 --------- Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-01-29refactor: migrate 'ext/node' extension to virtual ops module (#22157)Bartek Iwańczuk
Follow up to https://github.com/denoland/deno/pull/22135
2024-01-26chore: upgrade deno_core (#22124)Bartek Iwańczuk
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-01-26fix(node): remove deprecation warnings (#22120)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/22116
2024-01-25fix(fs): instanceof check for Deno.FsFile (#22121)Bartek Iwańczuk
Regression caused by https://github.com/denoland/deno/pull/22072. I added a relevant test so we don't regress again. Fixes https://github.com/denoland/deno/issues/22115
2024-01-24revert: Remove deprecations of file sync APIs (#22085)Bartek Iwańczuk
- `Deno.FsFile.dataSync` -> `Deno.FsFile.syncData` - `Deno.FsFile.dataSyncSync` -> `Deno.FsFile.syncDataSync` Also marks these APIs as unstable
2024-01-24feat: deprecate `Deno.fstat()` and `Deno.fstatSync()` (#22068)Asher Gomez
For removal in Deno v2.
2024-01-24feat: `Deno.FsFile.{utime,utimeSync}()` and deprecate ↵Asher Gomez
`Deno.{futime,futimeSync}` (#22070) For removal in Deno v2. --------- Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-24feat: deprecate `Deno.close()` (#22066)Asher Gomez
For removal in Deno v2. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-24feat: deprecate `Deno.ftruncate()` and `Deno.ftruncateSync()` (#22069)Asher Gomez
For removal in Deno 2.0.
2024-01-24feat: deprecate `Deno.FsFile` constructor and `Deno.FsFile.rid` (#22072)Asher Gomez
2024-01-24feat: `FsFile.sync()` and `FsFile.syncSync()` (#22017)Asher Gomez
This change: 1. Implements `Deno.FsFile.sync()` and `Deno.FsFile.syncSync()`. 2. Deprecates `Deno.fsync()` and `Deno.fsyncSync()` for removal in Deno v2, in favour of the above corresponding methods. Related #21995 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-24feat: `Deno.FsFile.dataSync()` and `Deno.FsFile.dataSyncSync()` (#22019)Asher Gomez
This change: 1. Implements `Deno.FsFile.dataSync()` and `Deno.FsFile.dataSyncSync()`. 2. Deprecates `Deno.fdatasync()` and `Deno.fdatasyncSync()` for removal in Deno v2, in favour of the above corresponding methods. 3. Replaces use of `Deno.fdatasync()` and `Deno.fdatasyncSync()` with the above instance methods. Related #21995
2024-01-23fix(ext/node): fix no arg call of fs.promises.readFile (#22030)Yoshiya Hinosawa
2024-01-10refactor: use `core.ensureFastOps()` (#21888)Kenta Moriuchi
2024-01-05chore: update deno_lint for CI (#21802)Kenta Moriuchi
2024-01-05fix(ci): update copright year for _fs_cp.js (#21803)Divy Srivastava
2024-01-05fix(ext/node): add fs.cp, fs.cpSync, promises.cp (#21745)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/20803 Fixes https://github.com/denoland/deno/issues/21723 Performance: copying a 48GiB rust `target` folder (recursive) | Platform | `deno` | `node v21.5` | Improvement | | -------- | ------- | ------- | ------- | | macOS (APFS) | 3.1secs | 127.99 secs | **42x** | | Windows | 18.3secs | 67.2secs | **3.8x** | Copying files with varying sizes: ![image](https://github.com/denoland/deno/assets/34997667/58932652-6f7a-47f5-8504-896dc9ab4ddc)