Skip to content

chore: update project config #274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
; package-lock with tarball deps breaks lerna/nx - remove when https://github.com/semantic-release/github/pull/487 is merged
package-lock=false
7 changes: 2 additions & 5 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
"lerna": "5.4.0",
"lerna": "6.0.1",
"useWorkspaces": true,
"version": "independent",
"command": {
"run": {
"stream": true
}
},
"packages": [
"packages/*"
]
}
}
35 changes: 18 additions & 17 deletions packages/ipfs-unixfs-exporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Lead Maintainer](#lead-maintainer)
- [Usage](#usage)
- [Example](#example)
- [API](#api)
- [Browser `<script>` tag](#browser-script-tag)
- [Example](#example)
- [API](#api)
- [`exporter(cid, blockstore, options)`](#exportercid-blockstore-options)
- [UnixFSEntry](#unixfsentry)
- [Raw entries](#raw-entries)
- [CBOR entries](#cbor-entries)
- [`entry.content({ offset, length })`](#entrycontent-offset-length-)
- [UnixFSEntry](#unixfsentry)
- [Raw entries](#raw-entries)
- [CBOR entries](#cbor-entries)
- [`entry.content({ offset, length })`](#entrycontent-offset-length-)
- [`walkPath(cid, blockstore)`](#walkpathcid-blockstore)
- [`recursive(cid, blockstore)`](#recursivecid-blockstore)
- [Contribute](#contribute)
Expand All @@ -31,13 +30,15 @@
$ npm i ipfs-unixfs-exporter
```

## Lead Maintainer
### Browser `<script>` tag

[Alex Potsides](https://github.com/achingbrain)
Loading this module through a script tag will make it's exports available as `IpfsUnixfsExporter` in the global namespace.

## Usage
```html
<script src="https://unpkg.com/ipfs-unixfs-exporter/dist/index.min.js"></script>
```

### Example
## Example

```js
// import a file and export it again
Expand Down Expand Up @@ -78,7 +79,7 @@ for await (const buf of entry.content()) {
console.info(bytes) // 0, 1, 2, 3
```

#### API
## API

```js
import { exporter } from 'ipfs-unixfs-exporter'
Expand All @@ -94,7 +95,7 @@ Returns a Promise which resolves to a `UnixFSEntry`.

- `signal` ([AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)): Used to cancel any network requests that are initiated as a result of this export

#### UnixFSEntry
### UnixFSEntry

```javascript
{
Expand Down Expand Up @@ -127,7 +128,7 @@ if (entry.type === 'directory') {
}
```

#### Raw entries
### Raw entries

Entries with a `raw` codec `CID` return raw entries:

Expand All @@ -151,7 +152,7 @@ for await (const chunk of entry.content()) {

Unless you an options object containing `offset` and `length` keys as an argument to `entry.content()`, `chunk` will be equal to `entry.node`.

#### CBOR entries
### CBOR entries

Entries with a `dag-cbor` codec `CID` return JavaScript object entries:

Expand All @@ -167,7 +168,7 @@ Entries with a `dag-cbor` codec `CID` return JavaScript object entries:

There is no `content` function for a `CBOR` node.

#### `entry.content({ offset, length })`
### `entry.content({ offset, length })`

When `entry` is a file or a `raw` node, `offset` and/or `length` arguments can be passed to `entry.content()` to return slices of data:

Expand Down
23 changes: 12 additions & 11 deletions packages/ipfs-unixfs-importer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Lead Maintainer <!-- omit in toc -->](#lead-maintainer----omit-in-toc---)
- [Usage](#usage)
- [Example](#example)
- [API](#api)
- [const stream = importer(source, blockstore \[, options\])](#const-stream--importersource-blockstore--options)
- [Browser `<script>` tag](#browser-script-tag)
- [Example](#example)
- [API](#api)
- [const stream = importer(source, blockstore \[, options\])](#const-stream--importersource-blockstore--options)
- [Overriding internals](#overriding-internals)
- [Contribute](#contribute)
- [License](#license)
Expand All @@ -26,13 +25,15 @@
$ npm i ipfs-unixfs-importer
```

## Lead Maintainer <!-- omit in toc -->
### Browser `<script>` tag

[Alex Potsides](https://github.com/achingbrain)
Loading this module through a script tag will make it's exports available as `IpfsUnixfsImporter` in the global namespace.

## Usage
```html
<script src="https://unpkg.com/ipfs-unixfs-importer/dist/index.min.js"></script>
```

### Example
## Example

Let's create a little directory to import:

Expand Down Expand Up @@ -91,13 +92,13 @@ When run, metadata about DAGNodes in the created tree is printed until the root:
}
```

#### API
## API

```js
import { importer } from 'ipfs-unixfs-importer'
```

#### const stream = importer(source, blockstore \[, options])
### const stream = importer(source, blockstore \[, options])

The `importer` function returns an async iterator takes a source async iterator that yields objects of the form:

Expand Down
74 changes: 30 additions & 44 deletions packages/ipfs-unixfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,20 @@
## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Lead Maintainer <!-- omit in toc -->](#lead-maintainer----omit-in-toc---)
- [Browser `<script>` tag](#browser-script-tag)
- [Spec](#spec)
- [Use in Node.js](#use-in-nodejs)
- [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)
- [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)
- [Usage](#usage)
- [Examples](#examples)
- [Create a file composed by several blocks](#create-a-file-composed-by-several-blocks)
- [Create a directory that contains several files](#create-a-directory-that-contains-several-files)
- [API](#api)
- - [UnixFS Data Structure](#unixfs-data-structure)
- [create an unixfs Data element](#create-an-unixfs-data-element)
- [add and remove a block size to the block size list](#add-and-remove-a-block-size-to-the-block-size-list)
- [get total fileSize](#get-total-filesize)
- [marshal and unmarshal](#marshal-and-unmarshal)
- [is this UnixFS entry a directory?](#is-this-unixfs-entry-a-directory)
- [has an mtime been set?](#has-an-mtime-been-set)
- [Examples](#examples)
- [Create a file composed by several blocks](#create-a-file-composed-by-several-blocks)
- [Create a directory that contains several files](#create-a-directory-that-contains-several-files)
- [UnixFS Data Structure](#unixfs-data-structure)
- [create an unixfs Data element](#create-an-unixfs-data-element)
- [add and remove a block size to the block size list](#add-and-remove-a-block-size-to-the-block-size-list)
- [get total fileSize](#get-total-filesize)
- [marshal and unmarshal](#marshal-and-unmarshal)
- [is this UnixFS entry a directory?](#is-this-unixfs-entry-a-directory)
- [has an mtime been set?](#has-an-mtime-been-set)
- [Contribute](#contribute)
- [License](#license)
- [Contribute](#contribute-1)
Expand All @@ -36,16 +34,18 @@
$ npm i ipfs-unixfs
```

The UnixFS spec can be found inside the [ipfs/specs repository](http://github.com/ipfs/specs)

## Lead Maintainer <!-- omit in toc -->
### Browser `<script>` tag

[Alex Potsides](https://github.com/achingbrain)
Loading this module through a script tag will make it's exports available as `IpfsUnixfs` in the global namespace.

```sh
> npm i ipfs-unixfs
```html
<script src="https://unpkg.com/ipfs-unixfs/dist/index.min.js"></script>
```

## Spec

The UnixFS spec can be found inside the [ipfs/specs repository](http://github.com/ipfs/specs)

### Use in Node.js

```JavaScript
Expand All @@ -60,21 +60,9 @@ The code published to npm that gets loaded on require is in fact a ES5 transpile
import { UnixFS } from 'ipfs-unixfs'
```

### Use in a browser Using a script tag
## Examples

Loading this module through a script tag will make the `UnixFS` obj available in the global namespace.

```html
<script src="https://npmcdn.com/ipfs-unixfs/dist/index.min.js"></script>
<!-- OR -->
<script src="https://npmcdn.com/ipfs-unixfs/dist/index.js"></script>
```

## Usage

### Examples

#### Create a file composed by several blocks
### Create a file composed by several blocks

```JavaScript
const data = new UnixFS({ type: 'file' })
Expand All @@ -83,17 +71,15 @@ data.addBlockSize(256)
// ...
```

#### Create a directory that contains several files
### Create a directory that contains several files

Creating a directory that contains several files is achieve by creating a unixfs element that identifies a MerkleDAG node as a directory. The links of that MerkleDAG node are the files that are contained in this directory.

```JavaScript
const data = new UnixFS({ type: 'directory' })
```

## API

#### UnixFS Data Structure
### UnixFS Data Structure

```protobuf
syntax = "proto2";
Expand Down Expand Up @@ -128,7 +114,7 @@ message Metadata {
}
```

#### create an unixfs Data element
### create an unixfs Data element

```JavaScript
const data = new UnixFS([options])
Expand All @@ -148,7 +134,7 @@ const data = new UnixFS([options])
- mode (Number, default `0644` for files, `0755` for directories/hamt-sharded-directories) file mode
- mtime (`Date`, `{ secs, nsecs }`, `{ Seconds, FractionalNanoseconds }`, `[ secs, nsecs ]`): The modification time of this node

#### add and remove a block size to the block size list
### add and remove a block size to the block size list

```JavaScript
data.addBlockSize(<size in bytes>)
Expand All @@ -158,20 +144,20 @@ data.addBlockSize(<size in bytes>)
data.removeBlockSize(<index>)
```

#### get total fileSize
### get total fileSize

```JavaScript
data.fileSize() // => size in bytes
```

#### marshal and unmarshal
### marshal and unmarshal

```javascript
const marshaled = data.marshal()
const unmarshaled = Unixfs.unmarshal(marshaled)
```

#### is this UnixFS entry a directory?
### is this UnixFS entry a directory?

```JavaScript
const dir = new Data({ type: 'directory' })
Expand All @@ -181,7 +167,7 @@ const file = new Data({ type: 'file' })
file.isDirectory() // false
```

#### has an mtime been set?
### has an mtime been set?

If no modification time has been set, no `mtime` property will be present on the `Data` instance:

Expand Down