mirror of
https://github.com/arthur-pbty/portfolio2023.git
synced 2026-06-13 23:58:21 +02:00
modified
This commit is contained in:
-24
@@ -1,24 +0,0 @@
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <https://unlicense.org>
|
||||
-124
@@ -1,124 +0,0 @@
|
||||
# memfs
|
||||
|
||||
[![][chat-badge]][chat] [![][npm-badge]][npm-url] [![][travis-badge]][travis-url]
|
||||
|
||||
In-memory file-system with [Node's `fs` API](https://nodejs.org/api/fs.html).
|
||||
|
||||
- Node's `fs` API implemented, see [_old API Status_](./docs/api-status.md), [missing list](https://github.com/streamich/memfs/issues/735), [missing `opendir`](https://github.com/streamich/memfs/issues/663)
|
||||
- Stores files in memory, in `Buffer`s
|
||||
- Throws sameish\* errors as Node.js
|
||||
- Has concept of _i-nodes_
|
||||
- Implements _hard links_
|
||||
- Implements _soft links_ (aka symlinks, symbolic links)
|
||||
- Permissions may\* be implemented in the future
|
||||
- Can be used in browser, see [`memfs-webpack`](https://github.com/streamich/memfs-webpack)
|
||||
|
||||
### Install
|
||||
|
||||
```shell
|
||||
npm install --save memfs
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import { fs } from 'memfs';
|
||||
|
||||
fs.writeFileSync('/hello.txt', 'World!');
|
||||
fs.readFileSync('/hello.txt', 'utf8'); // World!
|
||||
```
|
||||
|
||||
Create a file system from a plain JSON:
|
||||
|
||||
```js
|
||||
import { fs, vol } from 'memfs';
|
||||
|
||||
const json = {
|
||||
'./README.md': '1',
|
||||
'./src/index.js': '2',
|
||||
'./node_modules/debug/index.js': '3',
|
||||
};
|
||||
vol.fromJSON(json, '/app');
|
||||
|
||||
fs.readFileSync('/app/README.md', 'utf8'); // 1
|
||||
vol.readFileSync('/app/src/index.js', 'utf8'); // 2
|
||||
```
|
||||
|
||||
Export to JSON:
|
||||
|
||||
```js
|
||||
vol.writeFileSync('/script.sh', 'sudo rm -rf *');
|
||||
vol.toJSON(); // {"/script.sh": "sudo rm -rf *"}
|
||||
```
|
||||
|
||||
Use it for testing:
|
||||
|
||||
```js
|
||||
vol.writeFileSync('/foo', 'bar');
|
||||
expect(vol.toJSON()).toEqual({ '/foo': 'bar' });
|
||||
```
|
||||
|
||||
Create as many filesystem volumes as you need:
|
||||
|
||||
```js
|
||||
import { Volume } from 'memfs';
|
||||
|
||||
const vol = Volume.fromJSON({ '/foo': 'bar' });
|
||||
vol.readFileSync('/foo'); // bar
|
||||
|
||||
const vol2 = Volume.fromJSON({ '/foo': 'bar 2' });
|
||||
vol2.readFileSync('/foo'); // bar 2
|
||||
```
|
||||
|
||||
Use `memfs` together with [`unionfs`][unionfs] to create one filesystem
|
||||
from your in-memory volumes and the real disk filesystem:
|
||||
|
||||
```js
|
||||
import * as fs from 'fs';
|
||||
import { ufs } from 'unionfs';
|
||||
|
||||
ufs.use(fs).use(vol);
|
||||
|
||||
ufs.readFileSync('/foo'); // bar
|
||||
```
|
||||
|
||||
Use [`fs-monkey`][fs-monkey] to monkey-patch Node's `require` function:
|
||||
|
||||
```js
|
||||
import { patchRequire } from 'fs-monkey';
|
||||
|
||||
vol.writeFileSync('/index.js', 'console.log("hi world")');
|
||||
patchRequire(vol);
|
||||
require('/index'); // hi world
|
||||
```
|
||||
|
||||
## Docs
|
||||
|
||||
- [Reference](./docs/reference.md)
|
||||
- [Relative paths](./docs/relative-paths.md)
|
||||
- [API status](./docs/api-status.md)
|
||||
- [Dependencies](./docs/dependencies.md)
|
||||
|
||||
## See also
|
||||
|
||||
- [`spyfs`][spyfs] - spies on filesystem actions
|
||||
- [`unionfs`][unionfs] - creates a union of multiple filesystem volumes
|
||||
- [`linkfs`][linkfs] - redirects filesystem paths
|
||||
- [`fs-monkey`][fs-monkey] - monkey-patches Node's `fs` module and `require` function
|
||||
- [`libfs`](https://github.com/streamich/full-js/blob/master/src/lib/fs.ts) - real filesystem (that executes UNIX system calls) implemented in JavaScript
|
||||
|
||||
[chat]: https://onp4.com/@vadim/~memfs
|
||||
[chat-badge]: https://img.shields.io/badge/Chat-%F0%9F%92%AC-green?style=flat&logo=chat&link=https://onp4.com/@vadim/~memfs
|
||||
[npm-url]: https://www.npmjs.com/package/memfs
|
||||
[npm-badge]: https://img.shields.io/npm/v/memfs.svg
|
||||
[travis-url]: https://travis-ci.org/streamich/memfs
|
||||
[travis-badge]: https://travis-ci.org/streamich/memfs.svg?branch=master
|
||||
[memfs]: https://github.com/streamich/memfs
|
||||
[unionfs]: https://github.com/streamich/unionfs
|
||||
[linkfs]: https://github.com/streamich/linkfs
|
||||
[spyfs]: https://github.com/streamich/spyfs
|
||||
[fs-monkey]: https://github.com/streamich/fs-monkey
|
||||
|
||||
## License
|
||||
|
||||
[Unlicense](./LICENSE) - public domain.
|
||||
-102
@@ -1,102 +0,0 @@
|
||||
{
|
||||
"name": "memfs",
|
||||
"version": "3.5.3",
|
||||
"description": "In-memory file-system with Node's fs API.",
|
||||
"keywords": [
|
||||
"fs",
|
||||
"filesystem",
|
||||
"fs.js",
|
||||
"memory-fs",
|
||||
"memfs",
|
||||
"file",
|
||||
"file system",
|
||||
"mount",
|
||||
"memory",
|
||||
"in-memory",
|
||||
"virtual",
|
||||
"test",
|
||||
"testing",
|
||||
"mock"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/streamich/memfs.git"
|
||||
},
|
||||
"license": "Unlicense",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc -p . && cp src/getBigInt.js lib/",
|
||||
"clean": "rimraf lib types",
|
||||
"prettier": "prettier --ignore-path .gitignore --write \"src/**/*.{ts,js}\"",
|
||||
"prettier:diff": "prettier -l \"src/**/*.{ts,js}\"",
|
||||
"test": "jest --maxWorkers 2",
|
||||
"test:coverage": "jest --coverage",
|
||||
"test:watch": "jest --watch",
|
||||
"tslint": "tslint \"src/**/*.ts\" -t verbose",
|
||||
"typecheck": "tsc -p .",
|
||||
"watch": "watch \"npm run build\" ./src"
|
||||
},
|
||||
"commitlint": {
|
||||
"extends": [
|
||||
"@commitlint/config-conventional"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
"path": "git-cz"
|
||||
}
|
||||
},
|
||||
"release": {
|
||||
"prepare": [
|
||||
"@semantic-release/changelog",
|
||||
"@semantic-release/npm",
|
||||
"@semantic-release/git"
|
||||
],
|
||||
"verifyConditions": [
|
||||
"@semantic-release/changelog",
|
||||
"@semantic-release/npm",
|
||||
"@semantic-release/git"
|
||||
]
|
||||
},
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
"ts",
|
||||
"tsx",
|
||||
"js",
|
||||
"jsx"
|
||||
],
|
||||
"testEnvironment": "node",
|
||||
"testRegex": ".*/__tests__/.*\\.(test|spec)\\.(jsx?|tsx?)$",
|
||||
"transform": {
|
||||
"^.+\\.tsx?$": "ts-jest"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"fs-monkey": "^1.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@semantic-release/changelog": "^6.0.1",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/npm": "^9.0.1",
|
||||
"@types/jest": "^27.5.2",
|
||||
"@types/node": "^10.17.60",
|
||||
"husky": "^8.0.1",
|
||||
"jest": "^28.1.1",
|
||||
"prettier": "^2.7.1",
|
||||
"pretty-quick": "^3.1.3",
|
||||
"rimraf": "^3.0.2",
|
||||
"semantic-release": "^19.0.3",
|
||||
"ts-jest": "^28.0.5",
|
||||
"ts-node": "^10.8.1",
|
||||
"tslint": "^5.20.1",
|
||||
"tslint-config-common": "^1.6.0",
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 4.0.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user