takanawa-node 0.3.1
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 +41 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# takanawa-node
|
|
2
|
+
|
|
3
|
+
Node.js and Electron bindings for Takanawa, built with napi-rs and wrapped with a Vite + TypeScript API.
|
|
4
|
+
|
|
5
|
+
## Development
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm --filter takanawa-node build
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The package builds the native Node-API addon first, then emits the TypeScript wrapper as both ESM and CommonJS.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { DownloadTask, downloadToCompletion } from '@yetanother.ai/takanawa'
|
|
17
|
+
|
|
18
|
+
await downloadToCompletion({
|
|
19
|
+
url: 'https://example.com/file.zip',
|
|
20
|
+
targetPath: '/tmp/file.zip',
|
|
21
|
+
parallelism: 4,
|
|
22
|
+
hash: {
|
|
23
|
+
kind: 'sha256',
|
|
24
|
+
expected: '...64 hex characters...'
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const task = new DownloadTask({
|
|
29
|
+
url: 'https://example.com/file.zip',
|
|
30
|
+
targetPath: '/tmp/file.zip'
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
task.start()
|
|
34
|
+
console.log(task.snapshot())
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Large byte counts are exposed as `bigint` in the TypeScript API so Node and Electron callers do not lose precision.
|
|
38
|
+
|
|
39
|
+
`hash` supports `sha1`, `sha256`, `sha512`, `md5`, and `crc32` expected
|
|
40
|
+
digests. You can also pass a compact string such as `sha512:<hex>`. The legacy
|
|
41
|
+
`sha256` option remains available for existing callers.
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "takanawa-node",
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Node.js and Electron bindings for Takanawa powered by napi-rs.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/yetanother.ai/takanawa.git",
|
|
9
|
+
"directory": "packages/takanawa"
|
|
10
|
+
},
|
|
11
|
+
"main": "./dist/index.cjs",
|
|
12
|
+
"module": "./dist/index.mjs",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.mjs",
|
|
18
|
+
"require": "./dist/index.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"README.md",
|
|
23
|
+
"dist",
|
|
24
|
+
"index.js",
|
|
25
|
+
"*.node"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "pnpm run build:native && pnpm run build:ts",
|
|
29
|
+
"build:native": "napi build --platform --release",
|
|
30
|
+
"build:ts": "vite build && tsc -p tsconfig.json --emitDeclarationOnly",
|
|
31
|
+
"dev:native": "napi build --platform",
|
|
32
|
+
"dev:ts": "vite build --watch",
|
|
33
|
+
"test": "node --test __test__/*.test.mjs"
|
|
34
|
+
},
|
|
35
|
+
"napi": {
|
|
36
|
+
"name": "takanawa",
|
|
37
|
+
"binaryName": "takanawa",
|
|
38
|
+
"targets": [
|
|
39
|
+
"x86_64-unknown-linux-gnu",
|
|
40
|
+
"aarch64-unknown-linux-gnu",
|
|
41
|
+
"x86_64-apple-darwin",
|
|
42
|
+
"aarch64-apple-darwin",
|
|
43
|
+
"x86_64-pc-windows-msvc"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@napi-rs/cli": "^3.7.0",
|
|
48
|
+
"@types/node": "^24.10.1",
|
|
49
|
+
"typescript": "^5.9.3",
|
|
50
|
+
"vite": "^7.2.7"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=18.17.0"
|
|
54
|
+
}
|
|
55
|
+
}
|