File: README.md

package info (click to toggle)
node-yarnpkg 4.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 24,752 kB
  • sloc: javascript: 38,953; ansic: 26,035; cpp: 7,247; sh: 2,829; makefile: 724; perl: 493
file content (17 lines) | stat: -rw-r--r-- 1,072 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# `@yarnpkg/fslib`

A TypeScript library abstracting the Node filesystem APIs. We use it for three main reasons:

## Type-safe paths

Our library has two path types, `NativePath` and `PortablePath`. Most interfaces only accept the later, and instances of the former need to be transformed back and forth using our type-safe utilities before being usable.

## Custom filesystems

The FSLib implements various transparent filesystem layers for a variety of purposes. For instance we use it in Yarn in order to abstract away the zip archive manipulation logic, which is implemented in `ZipFS` and exposed through a Node-like interface (called `FakeFS`).

All `FakeFS` implementations can be transparently layered on top of the builtin Node `fs` module, and that's for instance how we can add support for in-zip package loading without you having to care about the exact package format.

## Promisified API

All methods from the `FakeFS` interface are promisified by default (and suffixed for greater clarity, for instance we offer both `readFileSync` and `readFilePromise`).