@ocfl/ocfl-fs 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,22 @@
1
- # ocfl-js - Filesystem storage implementation
1
+ # ocfl-fs - OCFL implementation using Filesystem storage backend for Node.js
2
2
  This is JavaScript/Node.js library to create and interact with Oxford Common File Layout (OCFL) storage and objects within it.
3
3
  This package implements the OCFL client that stores storage root and its objects on a locally attached filesystem.
4
4
 
5
+ ## Installation
6
+
7
+ npm install @ocfl/ocfl-fs
8
+
9
+ ## Usage
10
+
11
+ The storage and object methods accept an optional fs parameter, which can be any module that implements Node.js fs module API. By default, it will use the built in fs module.
12
+
13
+ const ocfl = require('@ocfl/ocfl-fs');
14
+ const storage = ocfl.storage({root: '/var/data/myocfl'});
15
+
16
+ For example, by passing it memfs (https://www.npmjs.com/package/memfs) the OCFL storage will be created in memory using the memfs module:
17
+
18
+ const ocfl = require('@ocfl/ocfl-fs');
19
+ const fs = require('memfs');
20
+ const storage = ocfl.storage({root: '/var/data/myocfl'}, {fs});
21
+
22
+ For common usage documentation please refer to the [README.md in GitHub](https://github.com/Arkisto-Platform/ocfl-js)
package/lib/store.js CHANGED
@@ -18,11 +18,6 @@ class OcflFsStore extends OcflStore {
18
18
  /** @type {Map<Object, OcflFsStore>} */
19
19
  static instances = new Map();
20
20
 
21
- /**
22
- *
23
- * @param {Object} options
24
- * @param {typeof fs} [options.fs]
25
- */
26
21
  // static getInstance({fs = require('fs')} = {}) {
27
22
  // let store = OcflFsStore.instances.get(fs);
28
23
  // if (!store) {
@@ -47,7 +42,7 @@ class OcflFsStore extends OcflStore {
47
42
  }
48
43
 
49
44
  async createReadStream(filePath, options) {
50
- await this.fs.promises.mkdir(path.dirname(filePath), { recursive: true });
45
+ //await this.fs.promises.mkdir(path.dirname(filePath), { recursive: true });
51
46
  return this.fs.createReadStream(filePath, options);
52
47
  }
53
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocfl/ocfl-fs",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Oxford Common File Layout (OCFL) JS client library for filesystem storage",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -41,10 +41,14 @@
41
41
  "jsdoc": "^3.6.10",
42
42
  "mocha": "^10.0.0",
43
43
  "typedoc": "^0.22.15",
44
- "@ocfl/ocfl-tests": "0.1.*"
44
+ "@ocfl/ocfl-tests": "*"
45
45
  },
46
46
  "dependencies": {
47
- "@ocfl/ocfl": "0.1.*"
47
+ "@ocfl/ocfl": "0.2.0"
48
48
  },
49
- "files": [ "index.js", "index.mjs", "lib" ]
49
+ "files": [
50
+ "index.js",
51
+ "index.mjs",
52
+ "lib"
53
+ ]
50
54
  }