telo 0.0.1 → 0.0.2
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 +53 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -1,7 +1,31 @@
|
|
|
1
|
+
Telo is a compact library for creating, serializing, and compressing WARC (Web ARChive) records from HTML pages or text content. It supports WARC 1.1 and produces gzip-compressed output ready for storage or transfer.
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Create WARC records (RESPONSE by default) with URL, HTTP headers, and custom metadata.
|
|
7
|
+
* Serialize WARCInfo records with metadata.
|
|
8
|
+
* Asynchronous content streaming for large pages.
|
|
9
|
+
* Gzip compression of combined WARCInfo and record.
|
|
10
|
+
* Fully compatible with WARC 1.1.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Installation
|
|
14
|
+
|
|
15
|
+
```shell
|
|
16
|
+
npm install telo
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Usage
|
|
21
|
+
|
|
1
22
|
```js
|
|
23
|
+
import {gunzipSync} from 'node:zlib';
|
|
24
|
+
import {Headers} from 'http-directives';
|
|
25
|
+
|
|
2
26
|
const telo = new Telo();
|
|
3
27
|
|
|
4
|
-
const record = await
|
|
28
|
+
const record = await telo.createRecord(
|
|
5
29
|
TeloTypes.RESPONSE,
|
|
6
30
|
'http://example.com',
|
|
7
31
|
'<body />',
|
|
@@ -16,3 +40,31 @@ const record = await warc.createRecord(
|
|
|
16
40
|
const uncompressed = gunzipSync(record);
|
|
17
41
|
const text = uncompressed.toString('utf-8');
|
|
18
42
|
```
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### API
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
Telo.createRecord(type, url, page, httpHeaders?, info?);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
* **type** — WARC record type (default: RESPONSE)
|
|
52
|
+
* **url** — URL of the page
|
|
53
|
+
* **page** — HTML or text content
|
|
54
|
+
* **httpHeaders** — optional HTTP headers object
|
|
55
|
+
* **info** — optional metadata object
|
|
56
|
+
|
|
57
|
+
Returns: `Promise<Buffer>` — gzip-compressed WARC record.
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
Telo.serializeInfo(filename, info);
|
|
61
|
+
```
|
|
62
|
+
* **filename** — WARC filename
|
|
63
|
+
* **info** — metadata object
|
|
64
|
+
|
|
65
|
+
Returns: `Promise<Uint8Array>` — serialized WARCInfo record.
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### License
|
|
69
|
+
|
|
70
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "telo",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Create, serialize, and gzip WARC 1.1 records from HTML or text content.",
|
|
4
5
|
"type": "module",
|
|
5
6
|
"author": "Telo, Inc.",
|
|
6
|
-
"
|
|
7
|
+
"license": "",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"warc",
|
|
10
|
+
"web-archive"
|
|
11
|
+
],
|
|
7
12
|
"files": [
|
|
8
13
|
"dist"
|
|
9
14
|
],
|