UNPKG

2.53 kBJavaScriptView Raw
1var BlobId = {
2 type: 'BlobId',
3 description: 'the hash of the blob, in ssb blob id format: &{hash-as-base64}.{hash-algorithum}',
4 optional: false
5}
6
7var BlobOpts = {
8 id: BlobId
9}
10
11module.exports = {
12 description: 'retrive, store, and share blobs',
13 commands: {
14 add: {
15 type: 'sink',
16 description: 'add a blob',
17 args: {
18 id: Object.assign(BlobId, {optional: true})
19 }
20 },
21 get: {
22 type: 'source',
23 description: 'get a blob',
24 args: BlobOpts
25 },
26 getSlice: {
27 type: 'source'
28, description: 'get part of a blob',
29 args: {
30 id: BlobId,
31 size: {
32 type: 'number',
33 description: 'reject if not exactly this size',
34 optional: true
35 },
36 max: {
37 type: 'number',
38 description: 'reject if more than this size',
39 optional: true
40 },
41 start: {
42 type: 'number',
43 description: 'start stream from this byte',
44 optional: true
45 },
46 end: {
47 type: 'number',
48 description: 'stream until this byte',
49 optional: true
50 }
51 }
52 },
53 has: {
54 type: 'async',
55 description: 'check if a blob is in the local store',
56 args: BlobOpts
57 },
58 size: {
59 type: 'async',
60 description: 'get the size for a blob in the local store',
61 args: BlobOpts
62 },
63 want: {
64 type: 'async',
65 description: 'request a blob from the network, wait until found or timeout',
66 args: BlobOpts
67 },
68 push: {
69 type: 'async',
70 description: 'ask the network to take the blob, wait until at least 3 peers have it',
71 args: BlobOpts
72 },
73 rm: {
74 type: 'async',
75 description: 'remove a blob from the local store',
76 args: BlobOpts
77 },
78 ls: {
79 type: 'source',
80 description: 'list all blobs',
81 args: {
82 meta: {
83 type: 'boolean',
84 description: 'include all metadata, id, size, receive timestamp',
85 optional: true
86 },
87 long: {
88 type: 'boolean',
89 description: 'long format, like in `ls -l synonym for --meta. `',
90 optional: true
91 },
92 old: {
93 type: 'boolean',
94 description: 'include old data, default: true',
95 optional: true
96 },
97 live: {
98 type: 'boolean',
99 description: 'stream real time changes, default: false',
100 optional: true
101 }
102 }
103 }
104 }
105
106}
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122