Skip to content

Commit 6a233fa

Browse files
committed
Improve readme, correct documentation errors
1 parent 6f5069b commit 6a233fa

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ OCFL objects inside the OCFL storage can be iterated with `for ... of` construct
8585
}
8686

8787

88-
## Object
88+
### Object
8989

9090
The OCFL Object can be instantiated by the storage root as described above. It can also be used directly without
9191
the storage root. For example, if you want to manipulate an ocfl object directory that is not associated with a storage layout.
@@ -100,15 +100,28 @@ Add a content to the object from a directory in the local file system. This will
100100

101101
Add multiple files from different sources as one transaction. All changes will be saved as one new version `v2`).
102102

103-
await object.update(async (t)=>{
104-
t.add()
105-
t.copy()
103+
await object.update(async (t) => {
104+
// create a new text file test.txt
105+
t.write('test.txt', 'abc');
106+
// add a file or folder '/home/john/data/b' to 'data/b'
107+
t.import('/home/john/data/b','data/b');
106108
});
107109

108110
List all existing files in the object
109111

110112
for await (let f of await object.files()) {
111113
// f is the logical path of the file
112-
let fileContent = await object.getFile(f).asString();
114+
let fileContent = await f.text();
113115
}
114116

117+
## Development
118+
119+
Clone the Git repo with submodules included:
120+
121+
git clone --recursive https://github.com/Language-Research-Technology/ocfl-js
122+
123+
The project is structured as a monorepo with multiple packages set up as npm workspaces.
124+
Install the dependencies for all workspaces:
125+
126+
cd ocfl-js
127+
npm install

ocfl/lib/transaction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class OcflObjectTransaction {
6363

6464
/**
6565
* Import content by recursively copying a file or directory from local file system to the
66-
* OCFL Object content. For example, `copy('/home/john/data/b','data/b')` will
66+
* OCFL Object content. For example, `object.import('/home/john/data/b','data/b')` will
6767
* copy `/home/john/data/b` from the local filesystem to the content `data/b` in the OFCL Object.
6868
* Set target to empty string ('') to copy a directory content to the object's content root.
6969
* If target is not specified, the base name of the source will be used.

0 commit comments

Comments
 (0)