Skip to content

Commit adb6b0e

Browse files
authored
feat: initial implementation (#1)
Adds unixfs commands: - cat - chmod - cp - ls - mkdir - rm - stat - touch Each file operates on a CID and returns a new CID that refers to a DAG with the changes made to it. This is largely a lift & shift of the MFS code from js-ipfs except it returns a CID instead of writing it to the datastore. The tests have been ported from the interface suite. Sharding support is mostly complete, a couple of rm tests are skipped for now.
1 parent bcb060d commit adb6b0e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+4096
-9
lines changed

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
time: "10:00"
8+
open-pull-requests-limit: 10
9+
commit-message:
10+
prefix: "deps"
11+
prefix-development: "deps(dev)"

.github/workflows/automerge.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: Automerge
2+
on: [ pull_request ]
3+
4+
jobs:
5+
automerge:
6+
uses: protocol/.github/.github/workflows/automerge.yml@master
7+
with:
8+
job: 'automerge'
+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: test & maybe release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
8+
jobs:
9+
10+
check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: lts/*
17+
- uses: ipfs/aegir/actions/cache-node-modules@master
18+
- run: npm run --if-present lint
19+
- run: npm run --if-present dep-check
20+
21+
test-node:
22+
needs: check
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
matrix:
26+
os: [windows-latest, ubuntu-latest, macos-latest]
27+
node: [lts/*]
28+
fail-fast: true
29+
steps:
30+
- uses: actions/checkout@v3
31+
- uses: actions/setup-node@v3
32+
with:
33+
node-version: ${{ matrix.node }}
34+
- uses: ipfs/aegir/actions/cache-node-modules@master
35+
- run: npm run --if-present test:node
36+
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
37+
with:
38+
flags: node
39+
40+
test-chrome:
41+
needs: check
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v3
45+
- uses: actions/setup-node@v3
46+
with:
47+
node-version: lts/*
48+
- uses: ipfs/aegir/actions/cache-node-modules@master
49+
- run: npm run --if-present test:chrome
50+
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
51+
with:
52+
flags: chrome
53+
54+
test-chrome-webworker:
55+
needs: check
56+
runs-on: ubuntu-latest
57+
steps:
58+
- uses: actions/checkout@v3
59+
- uses: actions/setup-node@v3
60+
with:
61+
node-version: lts/*
62+
- uses: ipfs/aegir/actions/cache-node-modules@master
63+
- run: npm run --if-present test:chrome-webworker
64+
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
65+
with:
66+
flags: chrome-webworker
67+
68+
test-firefox:
69+
needs: check
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v3
73+
- uses: actions/setup-node@v3
74+
with:
75+
node-version: lts/*
76+
- uses: ipfs/aegir/actions/cache-node-modules@master
77+
- run: npm run --if-present test:firefox
78+
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
79+
with:
80+
flags: firefox
81+
82+
test-firefox-webworker:
83+
needs: check
84+
runs-on: ubuntu-latest
85+
steps:
86+
- uses: actions/checkout@v3
87+
- uses: actions/setup-node@v3
88+
with:
89+
node-version: lts/*
90+
- uses: ipfs/aegir/actions/cache-node-modules@master
91+
- run: npm run --if-present test:firefox-webworker
92+
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
93+
with:
94+
flags: firefox-webworker
95+
96+
test-electron-main:
97+
needs: check
98+
runs-on: ubuntu-latest
99+
steps:
100+
- uses: actions/checkout@v3
101+
- uses: actions/setup-node@v3
102+
with:
103+
node-version: lts/*
104+
- uses: ipfs/aegir/actions/cache-node-modules@master
105+
- run: npx xvfb-maybe npm run --if-present test:electron-main
106+
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
107+
with:
108+
flags: electron-main
109+
110+
test-electron-renderer:
111+
needs: check
112+
runs-on: ubuntu-latest
113+
steps:
114+
- uses: actions/checkout@v3
115+
- uses: actions/setup-node@v3
116+
with:
117+
node-version: lts/*
118+
- uses: ipfs/aegir/actions/cache-node-modules@master
119+
- run: npx xvfb-maybe npm run --if-present test:electron-renderer
120+
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
121+
with:
122+
flags: electron-renderer
123+
124+
release:
125+
needs: [test-node, test-chrome, test-chrome-webworker, test-firefox, test-firefox-webworker, test-electron-main, test-electron-renderer]
126+
runs-on: ubuntu-latest
127+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
128+
steps:
129+
- uses: actions/checkout@v3
130+
with:
131+
fetch-depth: 0
132+
- uses: actions/setup-node@v3
133+
with:
134+
node-version: lts/*
135+
- uses: ipfs/aegir/actions/cache-node-modules@master
136+
- uses: ipfs/aegir/actions/docker-login@master
137+
with:
138+
docker-token: ${{ secrets.DOCKER_TOKEN }}
139+
docker-username: ${{ secrets.DOCKER_USERNAME }}
140+
- run: npm run --if-present release
141+
env:
142+
GITHUB_TOKEN: ${{ github.token }}
143+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules
2+
build
3+
dist
4+
.docs
5+
.coverage
6+
node_modules
7+
package-lock.json
8+
yarn.lock
9+
.vscode

LICENSE

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This project is dual licensed under MIT and Apache-2.0.
2+
3+
MIT: https://www.opensource.org/licenses/mit
4+
Apache-2.0: https://www.apache.org/licenses/license-2.0

LICENSE-APACHE

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
2+
3+
http://www.apache.org/licenses/LICENSE-2.0
4+
5+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

LICENSE-MIT

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
The MIT License (MIT)
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

README.md

+29-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1+
<p align="center">
2+
<a href="https://github.com/ipfs/helia" title="Helia">
3+
<img src="https://raw.githubusercontent.com/ipfs/helia/main/assets/helia.png" alt="Helia logo" width="300" />
4+
</a>
5+
</p>
6+
17
# @helia/unixfs <!-- omit in toc -->
28

39
[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)
410
[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)
5-
[![codecov](https://img.shields.io/codecov/c/github/ipfs/helia.svg?style=flat-square)](https://codecov.io/gh/ipfs/helia)
6-
[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/helia/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/ipfs/helia/actions/workflows/js-test-and-release.yml?query=branch%3Amain)
11+
[![codecov](https://img.shields.io/codecov/c/github/ipfs/helia-unixfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/helia-unixfs)
12+
[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/helia-unixfs/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/ipfs/helia-unixfs/actions/workflows/js-test-and-release.yml?query=branch%3Amain)
713

814
> A Helia-compatible wrapper for UnixFS
915
1016
## Table of contents <!-- omit in toc -->
1117

12-
- [Install](#install)
13-
- [Browser `<script>` tag](#browser-script-tag)
14-
- [API Docs](#api-docs)
15-
- [License](#license)
16-
- [Contribute](#contribute)
18+
- - [Install](#install)
19+
- [Browser `<script>` tag](#browser-script-tag)
20+
- [@helia/unixfs <!-- omit in toc -->](#heliaunixfs----omit-in-toc---)
21+
- [API Docs](#api-docs)
22+
- [License](#license)
23+
- [Contribute](#contribute)
1724

1825
## Install
1926

@@ -29,9 +36,22 @@ Loading this module through a script tag will make it's exports available as `He
2936
<script src="https://unpkg.com/@helia/unixfs/dist/index.min.js"></script>
3037
```
3138

39+
<p align="center">
40+
<a href="https://github.com/ipfs/helia" title="Helia">
41+
<img src="https://raw.githubusercontent.com/ipfs/helia/main/assets/helia.png" alt="Helia logo" width="300" />
42+
</a>
43+
</p>
44+
45+
# @helia/unixfs <!-- omit in toc -->
46+
47+
[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)
48+
[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)
49+
[![codecov](https://img.shields.io/codecov/c/github/ipfs/helia-unixfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/helia-unixfs)
50+
[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/helia-unixfs/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/ipfs/helia-unixfs/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)
51+
3252
## API Docs
3353

34-
- <https://ipfs.github.io/helia/modules/_helia_unixfs.html>
54+
- <https://ipfs.github.io/helia-unixfs>
3555

3656
## License
3757

@@ -42,7 +62,7 @@ Licensed under either of
4262

4363
## Contribute
4464

45-
Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia/issues).
65+
Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia-unixfs/issues).
4666

4767
Also see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.
4868

0 commit comments

Comments
 (0)