@webexatech/plugin-collection-transfer 0.0.0-stage → 0.1.3-nocobase.2.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/CHANGELOG.md +40 -0
- package/LICENSE +201 -0
- package/README.md +158 -3
- package/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/949.72b7b97eaf5473f5.js +10 -0
- package/dist/client/SettingsPage.d.ts +3 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +10 -0
- package/dist/client/plugin.d.ts +5 -0
- package/dist/client-v2/907.b7c707602a2b4e6c.js +10 -0
- package/dist/client-v2/CollectionTransferSettings.d.ts +22 -0
- package/dist/client-v2/SettingsPage.d.ts +4 -0
- package/dist/client-v2/index.d.ts +1 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/locale.d.ts +7 -0
- package/dist/client-v2/plugin.d.ts +7 -0
- package/dist/externalVersion.js +24 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +70 -0
- package/dist/locale/zh-CN.json +70 -0
- package/dist/node_modules/archiver/LICENSE +22 -0
- package/dist/node_modules/archiver/index.js +68 -0
- package/dist/node_modules/archiver/lib/core.js +974 -0
- package/dist/node_modules/archiver/lib/error.js +40 -0
- package/dist/node_modules/archiver/lib/plugins/json.js +110 -0
- package/dist/node_modules/archiver/lib/plugins/tar.js +167 -0
- package/dist/node_modules/archiver/lib/plugins/zip.js +120 -0
- package/dist/node_modules/archiver/node_modules/async/all.js +119 -0
- package/dist/node_modules/archiver/node_modules/async/allLimit.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/allSeries.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/any.js +122 -0
- package/dist/node_modules/archiver/node_modules/async/anyLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/anySeries.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/apply.js +11 -0
- package/dist/node_modules/archiver/node_modules/async/applyEach.js +57 -0
- package/dist/node_modules/archiver/node_modules/async/applyEachSeries.js +37 -0
- package/dist/node_modules/archiver/node_modules/async/asyncify.js +118 -0
- package/dist/node_modules/archiver/node_modules/async/auto.js +333 -0
- package/dist/node_modules/archiver/node_modules/async/autoInject.js +182 -0
- package/dist/node_modules/archiver/node_modules/async/bower.json +17 -0
- package/dist/node_modules/archiver/node_modules/async/cargo.js +63 -0
- package/dist/node_modules/archiver/node_modules/async/cargoQueue.js +71 -0
- package/dist/node_modules/archiver/node_modules/async/compose.js +55 -0
- package/dist/node_modules/archiver/node_modules/async/concat.js +115 -0
- package/dist/node_modules/archiver/node_modules/async/concatLimit.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/concatSeries.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/constant.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/detect.js +96 -0
- package/dist/node_modules/archiver/node_modules/async/detectLimit.js +48 -0
- package/dist/node_modules/archiver/node_modules/async/detectSeries.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/dir.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/dist/async.js +6062 -0
- package/dist/node_modules/archiver/node_modules/async/dist/async.min.js +1 -0
- package/dist/node_modules/archiver/node_modules/async/doDuring.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/doUntil.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/doWhilst.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/during.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/each.js +129 -0
- package/dist/node_modules/archiver/node_modules/async/eachLimit.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/eachOf.js +185 -0
- package/dist/node_modules/archiver/node_modules/async/eachOfLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/eachOfSeries.js +39 -0
- package/dist/node_modules/archiver/node_modules/async/eachSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/ensureAsync.js +67 -0
- package/dist/node_modules/archiver/node_modules/async/every.js +119 -0
- package/dist/node_modules/archiver/node_modules/async/everyLimit.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/everySeries.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/filter.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/filterLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/filterSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/find.js +96 -0
- package/dist/node_modules/archiver/node_modules/async/findLimit.js +48 -0
- package/dist/node_modules/archiver/node_modules/async/findSeries.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/flatMap.js +115 -0
- package/dist/node_modules/archiver/node_modules/async/flatMapLimit.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/flatMapSeries.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/foldl.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/foldr.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/forEach.js +129 -0
- package/dist/node_modules/archiver/node_modules/async/forEachLimit.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOf.js +185 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOfLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOfSeries.js +39 -0
- package/dist/node_modules/archiver/node_modules/async/forEachSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/forever.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/groupBy.js +108 -0
- package/dist/node_modules/archiver/node_modules/async/groupByLimit.js +71 -0
- package/dist/node_modules/archiver/node_modules/async/groupBySeries.js +36 -0
- package/dist/node_modules/archiver/node_modules/async/index.js +588 -0
- package/dist/node_modules/archiver/node_modules/async/inject.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/internal/DoublyLinkedList.js +92 -0
- package/dist/node_modules/archiver/node_modules/async/internal/Heap.js +120 -0
- package/dist/node_modules/archiver/node_modules/async/internal/applyEach.js +29 -0
- package/dist/node_modules/archiver/node_modules/async/internal/asyncEachOfLimit.js +75 -0
- package/dist/node_modules/archiver/node_modules/async/internal/awaitify.js +28 -0
- package/dist/node_modules/archiver/node_modules/async/internal/breakLoop.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/consoleFunc.js +31 -0
- package/dist/node_modules/archiver/node_modules/async/internal/createTester.js +40 -0
- package/dist/node_modules/archiver/node_modules/async/internal/eachOfLimit.js +90 -0
- package/dist/node_modules/archiver/node_modules/async/internal/filter.js +55 -0
- package/dist/node_modules/archiver/node_modules/async/internal/getIterator.js +11 -0
- package/dist/node_modules/archiver/node_modules/async/internal/initialParams.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/internal/isArrayLike.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/iterator.js +57 -0
- package/dist/node_modules/archiver/node_modules/async/internal/map.js +30 -0
- package/dist/node_modules/archiver/node_modules/async/internal/once.js +17 -0
- package/dist/node_modules/archiver/node_modules/async/internal/onlyOnce.js +15 -0
- package/dist/node_modules/archiver/node_modules/async/internal/parallel.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/internal/promiseCallback.js +23 -0
- package/dist/node_modules/archiver/node_modules/async/internal/queue.js +294 -0
- package/dist/node_modules/archiver/node_modules/async/internal/range.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/internal/reject.js +26 -0
- package/dist/node_modules/archiver/node_modules/async/internal/setImmediate.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/internal/withoutIndex.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/wrapAsync.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/log.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/map.js +142 -0
- package/dist/node_modules/archiver/node_modules/async/mapLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/mapSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/mapValues.js +152 -0
- package/dist/node_modules/archiver/node_modules/async/mapValuesLimit.js +61 -0
- package/dist/node_modules/archiver/node_modules/async/mapValuesSeries.js +37 -0
- package/dist/node_modules/archiver/node_modules/async/memoize.js +91 -0
- package/dist/node_modules/archiver/node_modules/async/nextTick.js +52 -0
- package/dist/node_modules/archiver/node_modules/async/package.json +75 -0
- package/dist/node_modules/archiver/node_modules/async/parallel.js +180 -0
- package/dist/node_modules/archiver/node_modules/async/parallelLimit.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/priorityQueue.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/queue.js +24 -0
- package/dist/node_modules/archiver/node_modules/async/race.js +67 -0
- package/dist/node_modules/archiver/node_modules/async/reduce.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/reduceRight.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/reflect.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/reflectAll.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/reject.js +87 -0
- package/dist/node_modules/archiver/node_modules/async/rejectLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/rejectSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/retry.js +159 -0
- package/dist/node_modules/archiver/node_modules/async/retryable.js +77 -0
- package/dist/node_modules/archiver/node_modules/async/select.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/selectLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/selectSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/seq.js +79 -0
- package/dist/node_modules/archiver/node_modules/async/series.js +186 -0
- package/dist/node_modules/archiver/node_modules/async/setImmediate.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/some.js +122 -0
- package/dist/node_modules/archiver/node_modules/async/someLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/someSeries.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/sortBy.js +190 -0
- package/dist/node_modules/archiver/node_modules/async/timeout.js +89 -0
- package/dist/node_modules/archiver/node_modules/async/times.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/timesLimit.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/timesSeries.js +32 -0
- package/dist/node_modules/archiver/node_modules/async/transform.js +173 -0
- package/dist/node_modules/archiver/node_modules/async/tryEach.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/unmemoize.js +25 -0
- package/dist/node_modules/archiver/node_modules/async/until.js +61 -0
- package/dist/node_modules/archiver/node_modules/async/waterfall.js +105 -0
- package/dist/node_modules/archiver/node_modules/async/whilst.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/wrapSync.js +118 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/errors-browser.js +127 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/errors.js +116 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/experimentalWarning.js +17 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/_stream_duplex.js +126 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/_stream_passthrough.js +37 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/_stream_readable.js +1027 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/_stream_transform.js +190 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/_stream_writable.js +641 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/async_iterator.js +180 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/buffer_list.js +183 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/from.js +52 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/pipeline.js +86 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/state.js +22 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/package.json +68 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/readable-browser.js +9 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/readable.js +16 -0
- package/dist/node_modules/archiver/node_modules/tar-stream/extract.js +257 -0
- package/dist/node_modules/archiver/node_modules/tar-stream/headers.js +295 -0
- package/dist/node_modules/archiver/node_modules/tar-stream/index.js +2 -0
- package/dist/node_modules/archiver/node_modules/tar-stream/pack.js +255 -0
- package/dist/node_modules/archiver/node_modules/tar-stream/package.json +58 -0
- package/dist/node_modules/archiver/node_modules/tar-stream/sandbox.js +11 -0
- package/dist/node_modules/archiver/package.json +1 -0
- package/dist/node_modules/yauzl/LICENSE +21 -0
- package/dist/node_modules/yauzl/index.js +1 -0
- package/dist/node_modules/yauzl/package.json +1 -0
- package/dist/server/exporter.d.ts +42 -0
- package/dist/server/exporter.js +311 -0
- package/dist/server/field-value-writer.d.ts +9 -0
- package/dist/server/field-value-writer.js +107 -0
- package/dist/server/importer.d.ts +138 -0
- package/dist/server/importer.js +842 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +42 -0
- package/dist/server/package-format.d.ts +50 -0
- package/dist/server/package-format.js +115 -0
- package/dist/server/plugin.d.ts +6 -0
- package/dist/server/plugin.js +61 -0
- package/dist/server/resourcer.d.ts +16 -0
- package/dist/server/resourcer.js +187 -0
- package/package.json +54 -4
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
var constants = require('fs-constants')
|
|
2
|
+
var eos = require('end-of-stream')
|
|
3
|
+
var inherits = require('inherits')
|
|
4
|
+
var alloc = Buffer.alloc
|
|
5
|
+
|
|
6
|
+
var Readable = require('readable-stream').Readable
|
|
7
|
+
var Writable = require('readable-stream').Writable
|
|
8
|
+
var StringDecoder = require('string_decoder').StringDecoder
|
|
9
|
+
|
|
10
|
+
var headers = require('./headers')
|
|
11
|
+
|
|
12
|
+
var DMODE = parseInt('755', 8)
|
|
13
|
+
var FMODE = parseInt('644', 8)
|
|
14
|
+
|
|
15
|
+
var END_OF_TAR = alloc(1024)
|
|
16
|
+
|
|
17
|
+
var noop = function () {}
|
|
18
|
+
|
|
19
|
+
var overflow = function (self, size) {
|
|
20
|
+
size &= 511
|
|
21
|
+
if (size) self.push(END_OF_TAR.slice(0, 512 - size))
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function modeToType (mode) {
|
|
25
|
+
switch (mode & constants.S_IFMT) {
|
|
26
|
+
case constants.S_IFBLK: return 'block-device'
|
|
27
|
+
case constants.S_IFCHR: return 'character-device'
|
|
28
|
+
case constants.S_IFDIR: return 'directory'
|
|
29
|
+
case constants.S_IFIFO: return 'fifo'
|
|
30
|
+
case constants.S_IFLNK: return 'symlink'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return 'file'
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var Sink = function (to) {
|
|
37
|
+
Writable.call(this)
|
|
38
|
+
this.written = 0
|
|
39
|
+
this._to = to
|
|
40
|
+
this._destroyed = false
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
inherits(Sink, Writable)
|
|
44
|
+
|
|
45
|
+
Sink.prototype._write = function (data, enc, cb) {
|
|
46
|
+
this.written += data.length
|
|
47
|
+
if (this._to.push(data)) return cb()
|
|
48
|
+
this._to._drain = cb
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
Sink.prototype.destroy = function () {
|
|
52
|
+
if (this._destroyed) return
|
|
53
|
+
this._destroyed = true
|
|
54
|
+
this.emit('close')
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
var LinkSink = function () {
|
|
58
|
+
Writable.call(this)
|
|
59
|
+
this.linkname = ''
|
|
60
|
+
this._decoder = new StringDecoder('utf-8')
|
|
61
|
+
this._destroyed = false
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
inherits(LinkSink, Writable)
|
|
65
|
+
|
|
66
|
+
LinkSink.prototype._write = function (data, enc, cb) {
|
|
67
|
+
this.linkname += this._decoder.write(data)
|
|
68
|
+
cb()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
LinkSink.prototype.destroy = function () {
|
|
72
|
+
if (this._destroyed) return
|
|
73
|
+
this._destroyed = true
|
|
74
|
+
this.emit('close')
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var Void = function () {
|
|
78
|
+
Writable.call(this)
|
|
79
|
+
this._destroyed = false
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
inherits(Void, Writable)
|
|
83
|
+
|
|
84
|
+
Void.prototype._write = function (data, enc, cb) {
|
|
85
|
+
cb(new Error('No body allowed for this entry'))
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
Void.prototype.destroy = function () {
|
|
89
|
+
if (this._destroyed) return
|
|
90
|
+
this._destroyed = true
|
|
91
|
+
this.emit('close')
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
var Pack = function (opts) {
|
|
95
|
+
if (!(this instanceof Pack)) return new Pack(opts)
|
|
96
|
+
Readable.call(this, opts)
|
|
97
|
+
|
|
98
|
+
this._drain = noop
|
|
99
|
+
this._finalized = false
|
|
100
|
+
this._finalizing = false
|
|
101
|
+
this._destroyed = false
|
|
102
|
+
this._stream = null
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
inherits(Pack, Readable)
|
|
106
|
+
|
|
107
|
+
Pack.prototype.entry = function (header, buffer, callback) {
|
|
108
|
+
if (this._stream) throw new Error('already piping an entry')
|
|
109
|
+
if (this._finalized || this._destroyed) return
|
|
110
|
+
|
|
111
|
+
if (typeof buffer === 'function') {
|
|
112
|
+
callback = buffer
|
|
113
|
+
buffer = null
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (!callback) callback = noop
|
|
117
|
+
|
|
118
|
+
var self = this
|
|
119
|
+
|
|
120
|
+
if (!header.size || header.type === 'symlink') header.size = 0
|
|
121
|
+
if (!header.type) header.type = modeToType(header.mode)
|
|
122
|
+
if (!header.mode) header.mode = header.type === 'directory' ? DMODE : FMODE
|
|
123
|
+
if (!header.uid) header.uid = 0
|
|
124
|
+
if (!header.gid) header.gid = 0
|
|
125
|
+
if (!header.mtime) header.mtime = new Date()
|
|
126
|
+
|
|
127
|
+
if (typeof buffer === 'string') buffer = Buffer.from(buffer)
|
|
128
|
+
if (Buffer.isBuffer(buffer)) {
|
|
129
|
+
header.size = buffer.length
|
|
130
|
+
this._encode(header)
|
|
131
|
+
var ok = this.push(buffer)
|
|
132
|
+
overflow(self, header.size)
|
|
133
|
+
if (ok) process.nextTick(callback)
|
|
134
|
+
else this._drain = callback
|
|
135
|
+
return new Void()
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (header.type === 'symlink' && !header.linkname) {
|
|
139
|
+
var linkSink = new LinkSink()
|
|
140
|
+
eos(linkSink, function (err) {
|
|
141
|
+
if (err) { // stream was closed
|
|
142
|
+
self.destroy()
|
|
143
|
+
return callback(err)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
header.linkname = linkSink.linkname
|
|
147
|
+
self._encode(header)
|
|
148
|
+
callback()
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
return linkSink
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
this._encode(header)
|
|
155
|
+
|
|
156
|
+
if (header.type !== 'file' && header.type !== 'contiguous-file') {
|
|
157
|
+
process.nextTick(callback)
|
|
158
|
+
return new Void()
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
var sink = new Sink(this)
|
|
162
|
+
|
|
163
|
+
this._stream = sink
|
|
164
|
+
|
|
165
|
+
eos(sink, function (err) {
|
|
166
|
+
self._stream = null
|
|
167
|
+
|
|
168
|
+
if (err) { // stream was closed
|
|
169
|
+
self.destroy()
|
|
170
|
+
return callback(err)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (sink.written !== header.size) { // corrupting tar
|
|
174
|
+
self.destroy()
|
|
175
|
+
return callback(new Error('size mismatch'))
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
overflow(self, header.size)
|
|
179
|
+
if (self._finalizing) self.finalize()
|
|
180
|
+
callback()
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
return sink
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
Pack.prototype.finalize = function () {
|
|
187
|
+
if (this._stream) {
|
|
188
|
+
this._finalizing = true
|
|
189
|
+
return
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (this._finalized) return
|
|
193
|
+
this._finalized = true
|
|
194
|
+
this.push(END_OF_TAR)
|
|
195
|
+
this.push(null)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
Pack.prototype.destroy = function (err) {
|
|
199
|
+
if (this._destroyed) return
|
|
200
|
+
this._destroyed = true
|
|
201
|
+
|
|
202
|
+
if (err) this.emit('error', err)
|
|
203
|
+
this.emit('close')
|
|
204
|
+
if (this._stream && this._stream.destroy) this._stream.destroy()
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
Pack.prototype._encode = function (header) {
|
|
208
|
+
if (!header.pax) {
|
|
209
|
+
var buf = headers.encode(header)
|
|
210
|
+
if (buf) {
|
|
211
|
+
this.push(buf)
|
|
212
|
+
return
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
this._encodePax(header)
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
Pack.prototype._encodePax = function (header) {
|
|
219
|
+
var paxHeader = headers.encodePax({
|
|
220
|
+
name: header.name,
|
|
221
|
+
linkname: header.linkname,
|
|
222
|
+
pax: header.pax
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
var newHeader = {
|
|
226
|
+
name: 'PaxHeader',
|
|
227
|
+
mode: header.mode,
|
|
228
|
+
uid: header.uid,
|
|
229
|
+
gid: header.gid,
|
|
230
|
+
size: paxHeader.length,
|
|
231
|
+
mtime: header.mtime,
|
|
232
|
+
type: 'pax-header',
|
|
233
|
+
linkname: header.linkname && 'PaxHeader',
|
|
234
|
+
uname: header.uname,
|
|
235
|
+
gname: header.gname,
|
|
236
|
+
devmajor: header.devmajor,
|
|
237
|
+
devminor: header.devminor
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
this.push(headers.encode(newHeader))
|
|
241
|
+
this.push(paxHeader)
|
|
242
|
+
overflow(this, paxHeader.length)
|
|
243
|
+
|
|
244
|
+
newHeader.size = header.size
|
|
245
|
+
newHeader.type = header.type
|
|
246
|
+
this.push(headers.encode(newHeader))
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
Pack.prototype._read = function (n) {
|
|
250
|
+
var drain = this._drain
|
|
251
|
+
this._drain = noop
|
|
252
|
+
drain()
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
module.exports = Pack
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tar-stream",
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"description": "tar-stream is a streaming tar parser and generator and nothing else. It is streams2 and operates purely using streams which means you can easily extract/parse tarballs without ever hitting the file system.",
|
|
5
|
+
"author": "Mathias Buus <mathiasbuus@gmail.com>",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"bl": "^4.0.3",
|
|
8
|
+
"end-of-stream": "^1.4.1",
|
|
9
|
+
"fs-constants": "^1.0.0",
|
|
10
|
+
"inherits": "^2.0.3",
|
|
11
|
+
"readable-stream": "^3.1.1"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"concat-stream": "^2.0.0",
|
|
15
|
+
"standard": "^12.0.1",
|
|
16
|
+
"tape": "^4.9.2"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"test": "standard && tape test/extract.js test/pack.js",
|
|
20
|
+
"test-all": "standard && tape test/*.js"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"tar",
|
|
24
|
+
"tarball",
|
|
25
|
+
"parse",
|
|
26
|
+
"parser",
|
|
27
|
+
"generate",
|
|
28
|
+
"generator",
|
|
29
|
+
"stream",
|
|
30
|
+
"stream2",
|
|
31
|
+
"streams",
|
|
32
|
+
"streams2",
|
|
33
|
+
"streaming",
|
|
34
|
+
"pack",
|
|
35
|
+
"extract",
|
|
36
|
+
"modify"
|
|
37
|
+
],
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/mafintosh/tar-stream/issues"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://github.com/mafintosh/tar-stream",
|
|
42
|
+
"main": "index.js",
|
|
43
|
+
"files": [
|
|
44
|
+
"*.js",
|
|
45
|
+
"LICENSE"
|
|
46
|
+
],
|
|
47
|
+
"directories": {
|
|
48
|
+
"test": "test"
|
|
49
|
+
},
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "git+https://github.com/mafintosh/tar-stream.git"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=6"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const tar = require('tar-stream')
|
|
2
|
+
const fs = require('fs')
|
|
3
|
+
const path = require('path')
|
|
4
|
+
const pipeline = require('pump') // eequire('stream').pipeline
|
|
5
|
+
|
|
6
|
+
fs.createReadStream('test.tar')
|
|
7
|
+
.pipe(tar.extract())
|
|
8
|
+
.on('entry', function (header, stream, done) {
|
|
9
|
+
console.log(header.name)
|
|
10
|
+
pipeline(stream, fs.createWriteStream(path.join('/tmp', header.name)), done)
|
|
11
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"archiver","version":"5.3.2","description":"a streaming interface for archive generation","homepage":"https://github.com/archiverjs/node-archiver","author":{"name":"Chris Talkington","url":"http://christalkington.com/"},"repository":{"type":"git","url":"https://github.com/archiverjs/node-archiver.git"},"bugs":{"url":"https://github.com/archiverjs/node-archiver/issues"},"license":"MIT","main":"index.js","files":["index.js","lib"],"engines":{"node":">= 10"},"scripts":{"test":"mocha --reporter dot","bench":"node benchmark/simple/pack-zip.js"},"dependencies":{"archiver-utils":"^2.1.0","async":"^3.2.4","buffer-crc32":"^0.2.1","readable-stream":"^3.6.0","readdir-glob":"^1.1.2","tar-stream":"^2.2.0","zip-stream":"^4.1.0"},"devDependencies":{"archiver-jsdoc-theme":"^1.1.3","chai":"^4.3.7","jsdoc":"^3.6.4","mkdirp":"^2.1.5","mocha":"^9.0.2","rimraf":"^4.3.1","stream-bench":"^0.1.2","tar":"^6.1.13","yauzl":"^2.9.0"},"keywords":["archive","archiver","stream","zip","tar"],"publishConfig":{"registry":"https://registry.npmjs.org/"},"_lastModified":"2026-11-22T14:30:02.383Z"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Josh Wolfe
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{var e={794:(e,r,t)=>{var n=t(300).Buffer;var i=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];if(typeof Int32Array!=="undefined"){i=new Int32Array(i)}function ensureBuffer(e){if(n.isBuffer(e)){return e}var r=typeof n.alloc==="function"&&typeof n.from==="function";if(typeof e==="number"){return r?n.alloc(e):new n(e)}else if(typeof e==="string"){return r?n.from(e):new n(e)}else{throw new Error("input must be buffer, number, or string, received "+typeof e)}}function bufferizeInt(e){var r=ensureBuffer(4);r.writeInt32BE(e,0);return r}function _crc32(e,r){e=ensureBuffer(e);if(n.isBuffer(r)){r=r.readUInt32BE(0)}var t=~~r^-1;for(var o=0;o<e.length;o++){t=i[(t^e[o])&255]^t>>>8}return t^-1}function crc32(){return bufferizeInt(_crc32.apply(null,arguments))}crc32.signed=function(){return _crc32.apply(null,arguments)};crc32.unsigned=function(){return _crc32.apply(null,arguments)>>>0};e.exports=crc32},10:(e,r,t)=>{var n=t(147);var i=t(837);var o=t(955);var s=o.Readable;var a=o.Writable;var f=o.PassThrough;var d=t(833);var u=t(361).EventEmitter;r.createFromBuffer=createFromBuffer;r.createFromFd=createFromFd;r.BufferSlicer=BufferSlicer;r.FdSlicer=FdSlicer;i.inherits(FdSlicer,u);function FdSlicer(e,r){r=r||{};u.call(this);this.fd=e;this.pend=new d;this.pend.max=1;this.refCount=0;this.autoClose=!!r.autoClose}FdSlicer.prototype.read=function(e,r,t,i,o){var s=this;s.pend.go((function(a){n.read(s.fd,e,r,t,i,(function(e,r,t){a();o(e,r,t)}))}))};FdSlicer.prototype.write=function(e,r,t,i,o){var s=this;s.pend.go((function(a){n.write(s.fd,e,r,t,i,(function(e,r,t){a();o(e,r,t)}))}))};FdSlicer.prototype.createReadStream=function(e){return new ReadStream(this,e)};FdSlicer.prototype.createWriteStream=function(e){return new WriteStream(this,e)};FdSlicer.prototype.ref=function(){this.refCount+=1};FdSlicer.prototype.unref=function(){var e=this;e.refCount-=1;if(e.refCount>0)return;if(e.refCount<0)throw new Error("invalid unref");if(e.autoClose){n.close(e.fd,onCloseDone)}function onCloseDone(r){if(r){e.emit("error",r)}else{e.emit("close")}}};i.inherits(ReadStream,s);function ReadStream(e,r){r=r||{};s.call(this,r);this.context=e;this.context.ref();this.start=r.start||0;this.endOffset=r.end;this.pos=this.start;this.destroyed=false}ReadStream.prototype._read=function(e){var r=this;if(r.destroyed)return;var t=Math.min(r._readableState.highWaterMark,e);if(r.endOffset!=null){t=Math.min(t,r.endOffset-r.pos)}if(t<=0){r.destroyed=true;r.push(null);r.context.unref();return}r.context.pend.go((function(e){if(r.destroyed)return e();var i=new Buffer(t);n.read(r.context.fd,i,0,t,r.pos,(function(t,n){if(t){r.destroy(t)}else if(n===0){r.destroyed=true;r.push(null);r.context.unref()}else{r.pos+=n;r.push(i.slice(0,n))}e()}))}))};ReadStream.prototype.destroy=function(e){if(this.destroyed)return;e=e||new Error("stream destroyed");this.destroyed=true;this.emit("error",e);this.context.unref()};i.inherits(WriteStream,a);function WriteStream(e,r){r=r||{};a.call(this,r);this.context=e;this.context.ref();this.start=r.start||0;this.endOffset=r.end==null?Infinity:+r.end;this.bytesWritten=0;this.pos=this.start;this.destroyed=false;this.on("finish",this.destroy.bind(this))}WriteStream.prototype._write=function(e,r,t){var i=this;if(i.destroyed)return;if(i.pos+e.length>i.endOffset){var o=new Error("maximum file length exceeded");o.code="ETOOBIG";i.destroy();t(o);return}i.context.pend.go((function(r){if(i.destroyed)return r();n.write(i.context.fd,e,0,e.length,i.pos,(function(e,n){if(e){i.destroy();r();t(e)}else{i.bytesWritten+=n;i.pos+=n;i.emit("progress");r();t()}}))}))};WriteStream.prototype.destroy=function(){if(this.destroyed)return;this.destroyed=true;this.context.unref()};i.inherits(BufferSlicer,u);function BufferSlicer(e,r){u.call(this);r=r||{};this.refCount=0;this.buffer=e;this.maxChunkSize=r.maxChunkSize||Number.MAX_SAFE_INTEGER}BufferSlicer.prototype.read=function(e,r,t,n,i){var o=n+t;var s=o-this.buffer.length;var a=s>0?s:t;this.buffer.copy(e,r,n,o);setImmediate((function(){i(null,a)}))};BufferSlicer.prototype.write=function(e,r,t,n,i){e.copy(this.buffer,n,r,r+t);setImmediate((function(){i(null,t,e)}))};BufferSlicer.prototype.createReadStream=function(e){e=e||{};var r=new f(e);r.destroyed=false;r.start=e.start||0;r.endOffset=e.end;r.pos=r.endOffset||this.buffer.length;var t=this.buffer.slice(r.start,r.pos);var n=0;while(true){var i=n+this.maxChunkSize;if(i>=t.length){if(n<t.length){r.write(t.slice(n,t.length))}break}r.write(t.slice(n,i));n=i}r.end();r.destroy=function(){r.destroyed=true};return r};BufferSlicer.prototype.createWriteStream=function(e){var r=this;e=e||{};var t=new a(e);t.start=e.start||0;t.endOffset=e.end==null?this.buffer.length:+e.end;t.bytesWritten=0;t.pos=t.start;t.destroyed=false;t._write=function(e,n,i){if(t.destroyed)return;var o=t.pos+e.length;if(o>t.endOffset){var s=new Error("maximum file length exceeded");s.code="ETOOBIG";t.destroyed=true;i(s);return}e.copy(r.buffer,t.pos,0,e.length);t.bytesWritten+=e.length;t.pos=o;t.emit("progress");i()};t.destroy=function(){t.destroyed=true};return t};BufferSlicer.prototype.ref=function(){this.refCount+=1};BufferSlicer.prototype.unref=function(){this.refCount-=1;if(this.refCount<0){throw new Error("invalid unref")}};function createFromBuffer(e,r){return new BufferSlicer(e,r)}function createFromFd(e,r){return new FdSlicer(e,r)}},833:e=>{e.exports=Pend;function Pend(){this.pending=0;this.max=Infinity;this.listeners=[];this.waiting=[];this.error=null}Pend.prototype.go=function(e){if(this.pending<this.max){pendGo(this,e)}else{this.waiting.push(e)}};Pend.prototype.wait=function(e){if(this.pending===0){e(this.error)}else{this.listeners.push(e)}};Pend.prototype.hold=function(){return pendHold(this)};function pendHold(e){e.pending+=1;var r=false;return onCb;function onCb(t){if(r)throw new Error("callback called twice");r=true;e.error=e.error||t;e.pending-=1;if(e.waiting.length>0&&e.pending<e.max){pendGo(e,e.waiting.shift())}else if(e.pending===0){var n=e.listeners;e.listeners=[];n.forEach(cbListener)}}function cbListener(r){r(e.error)}}function pendGo(e,r){r(pendHold(e))}},300:e=>{"use strict";e.exports=require("buffer")},361:e=>{"use strict";e.exports=require("events")},147:e=>{"use strict";e.exports=require("fs")},955:e=>{"use strict";e.exports=require("stream")},837:e=>{"use strict";e.exports=require("util")},796:e=>{"use strict";e.exports=require("zlib")}};var r={};function __nccwpck_require__(t){var n=r[t];if(n!==undefined){return n.exports}var i=r[t]={exports:{}};var o=true;try{e[t](i,i.exports,__nccwpck_require__);o=false}finally{if(o)delete r[t]}return i.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t={};(()=>{var e=t;var r=__nccwpck_require__(147);var n=__nccwpck_require__(796);var i=__nccwpck_require__(10);var o=__nccwpck_require__(794);var s=__nccwpck_require__(837);var a=__nccwpck_require__(361).EventEmitter;var f=__nccwpck_require__(955).Transform;var d=__nccwpck_require__(955).PassThrough;var u=__nccwpck_require__(955).Writable;e.open=open;e.fromFd=fromFd;e.fromBuffer=fromBuffer;e.fromRandomAccessReader=fromRandomAccessReader;e.dosDateTimeToDate=dosDateTimeToDate;e.validateFileName=validateFileName;e.ZipFile=ZipFile;e.Entry=Entry;e.RandomAccessReader=RandomAccessReader;function open(e,t,n){if(typeof t==="function"){n=t;t=null}if(t==null)t={};if(t.autoClose==null)t.autoClose=true;if(t.lazyEntries==null)t.lazyEntries=false;if(t.decodeStrings==null)t.decodeStrings=true;if(t.validateEntrySizes==null)t.validateEntrySizes=true;if(t.strictFileNames==null)t.strictFileNames=false;if(n==null)n=defaultCallback;r.open(e,"r",(function(e,i){if(e)return n(e);fromFd(i,t,(function(e,t){if(e)r.close(i,defaultCallback);n(e,t)}))}))}function fromFd(e,t,n){if(typeof t==="function"){n=t;t=null}if(t==null)t={};if(t.autoClose==null)t.autoClose=false;if(t.lazyEntries==null)t.lazyEntries=false;if(t.decodeStrings==null)t.decodeStrings=true;if(t.validateEntrySizes==null)t.validateEntrySizes=true;if(t.strictFileNames==null)t.strictFileNames=false;if(n==null)n=defaultCallback;r.fstat(e,(function(r,o){if(r)return n(r);var s=i.createFromFd(e,{autoClose:true});fromRandomAccessReader(s,o.size,t,n)}))}function fromBuffer(e,r,t){if(typeof r==="function"){t=r;r=null}if(r==null)r={};r.autoClose=false;if(r.lazyEntries==null)r.lazyEntries=false;if(r.decodeStrings==null)r.decodeStrings=true;if(r.validateEntrySizes==null)r.validateEntrySizes=true;if(r.strictFileNames==null)r.strictFileNames=false;var n=i.createFromBuffer(e,{maxChunkSize:65536});fromRandomAccessReader(n,e.length,r,t)}function fromRandomAccessReader(e,r,t,n){if(typeof t==="function"){n=t;t=null}if(t==null)t={};if(t.autoClose==null)t.autoClose=true;if(t.lazyEntries==null)t.lazyEntries=false;if(t.decodeStrings==null)t.decodeStrings=true;var i=!!t.decodeStrings;if(t.validateEntrySizes==null)t.validateEntrySizes=true;if(t.strictFileNames==null)t.strictFileNames=false;if(n==null)n=defaultCallback;if(typeof r!=="number")throw new Error("expected totalSize parameter to be a number");if(r>Number.MAX_SAFE_INTEGER){throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.")}e.ref();var o=22;var s=65535;var a=Math.min(o+s,r);var f=c(a);var d=r-f.length;readAndAssertNoEof(e,f,0,a,d,(function(s){if(s)return n(s);for(var u=a-o;u>=0;u-=1){if(f.readUInt32LE(u)!==101010256)continue;var l=f.slice(u);var p=l.readUInt16LE(4);if(p!==0){return n(new Error("multi-disk zip files are not supported: found disk number: "+p))}var m=l.readUInt16LE(10);var h=l.readUInt32LE(16);var y=l.readUInt16LE(20);var v=l.length-o;if(y!==v){return n(new Error("invalid comment length. expected: "+v+". found: "+y))}var E=i?decodeBuffer(l,22,l.length,false):l.slice(22);if(!(m===65535||h===4294967295)){return n(null,new ZipFile(e,h,r,m,E,t.autoClose,t.lazyEntries,i,t.validateEntrySizes,t.strictFileNames))}var w=c(20);var g=d+u-w.length;readAndAssertNoEof(e,w,0,w.length,g,(function(o){if(o)return n(o);if(w.readUInt32LE(0)!==117853008){return n(new Error("invalid zip64 end of central directory locator signature"))}var s=readUInt64LE(w,8);var a=c(56);readAndAssertNoEof(e,a,0,a.length,s,(function(o){if(o)return n(o);if(a.readUInt32LE(0)!==101075792){return n(new Error("invalid zip64 end of central directory record signature"))}m=readUInt64LE(a,32);h=readUInt64LE(a,48);return n(null,new ZipFile(e,h,r,m,E,t.autoClose,t.lazyEntries,i,t.validateEntrySizes,t.strictFileNames))}))}));return}n(new Error("end of central directory record signature not found"))}))}s.inherits(ZipFile,a);function ZipFile(e,r,t,n,i,o,s,f,d,u){var l=this;a.call(l);l.reader=e;l.reader.on("error",(function(e){emitError(l,e)}));l.reader.once("close",(function(){l.emit("close")}));l.readEntryCursor=r;l.fileSize=t;l.entryCount=n;l.comment=i;l.entriesRead=0;l.autoClose=!!o;l.lazyEntries=!!s;l.decodeStrings=!!f;l.validateEntrySizes=!!d;l.strictFileNames=!!u;l.isOpen=true;l.emittedError=false;if(!l.lazyEntries)l._readEntry()}ZipFile.prototype.close=function(){if(!this.isOpen)return;this.isOpen=false;this.reader.unref()};function emitErrorAndAutoClose(e,r){if(e.autoClose)e.close();emitError(e,r)}function emitError(e,r){if(e.emittedError)return;e.emittedError=true;e.emit("error",r)}ZipFile.prototype.readEntry=function(){if(!this.lazyEntries)throw new Error("readEntry() called without lazyEntries:true");this._readEntry()};ZipFile.prototype._readEntry=function(){var e=this;if(e.entryCount===e.entriesRead){setImmediate((function(){if(e.autoClose)e.close();if(e.emittedError)return;e.emit("end")}));return}if(e.emittedError)return;var r=c(46);readAndAssertNoEof(e.reader,r,0,r.length,e.readEntryCursor,(function(t){if(t)return emitErrorAndAutoClose(e,t);if(e.emittedError)return;var n=new Entry;var i=r.readUInt32LE(0);if(i!==33639248)return emitErrorAndAutoClose(e,new Error("invalid central directory file header signature: 0x"+i.toString(16)));n.versionMadeBy=r.readUInt16LE(4);n.versionNeededToExtract=r.readUInt16LE(6);n.generalPurposeBitFlag=r.readUInt16LE(8);n.compressionMethod=r.readUInt16LE(10);n.lastModFileTime=r.readUInt16LE(12);n.lastModFileDate=r.readUInt16LE(14);n.crc32=r.readUInt32LE(16);n.compressedSize=r.readUInt32LE(20);n.uncompressedSize=r.readUInt32LE(24);n.fileNameLength=r.readUInt16LE(28);n.extraFieldLength=r.readUInt16LE(30);n.fileCommentLength=r.readUInt16LE(32);n.internalFileAttributes=r.readUInt16LE(36);n.externalFileAttributes=r.readUInt32LE(38);n.relativeOffsetOfLocalHeader=r.readUInt32LE(42);if(n.generalPurposeBitFlag&64)return emitErrorAndAutoClose(e,new Error("strong encryption is not supported"));e.readEntryCursor+=46;r=c(n.fileNameLength+n.extraFieldLength+n.fileCommentLength);readAndAssertNoEof(e.reader,r,0,r.length,e.readEntryCursor,(function(t){if(t)return emitErrorAndAutoClose(e,t);if(e.emittedError)return;var i=(n.generalPurposeBitFlag&2048)!==0;n.fileName=e.decodeStrings?decodeBuffer(r,0,n.fileNameLength,i):r.slice(0,n.fileNameLength);var s=n.fileNameLength+n.extraFieldLength;var a=r.slice(n.fileNameLength,s);n.extraFields=[];var f=0;while(f<a.length-3){var d=a.readUInt16LE(f+0);var u=a.readUInt16LE(f+2);var l=f+4;var p=l+u;if(p>a.length)return emitErrorAndAutoClose(e,new Error("extra field length exceeds extra field buffer size"));var m=c(u);a.copy(m,0,l,p);n.extraFields.push({id:d,data:m});f=p}n.fileComment=e.decodeStrings?decodeBuffer(r,s,s+n.fileCommentLength,i):r.slice(s,s+n.fileCommentLength);n.comment=n.fileComment;e.readEntryCursor+=r.length;e.entriesRead+=1;if(n.uncompressedSize===4294967295||n.compressedSize===4294967295||n.relativeOffsetOfLocalHeader===4294967295){var h=null;for(var f=0;f<n.extraFields.length;f++){var y=n.extraFields[f];if(y.id===1){h=y.data;break}}if(h==null){return emitErrorAndAutoClose(e,new Error("expected zip64 extended information extra field"))}var v=0;if(n.uncompressedSize===4294967295){if(v+8>h.length){return emitErrorAndAutoClose(e,new Error("zip64 extended information extra field does not include uncompressed size"))}n.uncompressedSize=readUInt64LE(h,v);v+=8}if(n.compressedSize===4294967295){if(v+8>h.length){return emitErrorAndAutoClose(e,new Error("zip64 extended information extra field does not include compressed size"))}n.compressedSize=readUInt64LE(h,v);v+=8}if(n.relativeOffsetOfLocalHeader===4294967295){if(v+8>h.length){return emitErrorAndAutoClose(e,new Error("zip64 extended information extra field does not include relative header offset"))}n.relativeOffsetOfLocalHeader=readUInt64LE(h,v);v+=8}}if(e.decodeStrings){for(var f=0;f<n.extraFields.length;f++){var y=n.extraFields[f];if(y.id===28789){if(y.data.length<6){continue}if(y.data.readUInt8(0)!==1){continue}var E=y.data.readUInt32LE(1);if(o.unsigned(r.slice(0,n.fileNameLength))!==E){continue}n.fileName=decodeBuffer(y.data,5,y.data.length,true);break}}}if(e.validateEntrySizes&&n.compressionMethod===0){var w=n.uncompressedSize;if(n.isEncrypted()){w+=12}if(n.compressedSize!==w){var g="compressed/uncompressed size mismatch for stored file: "+n.compressedSize+" != "+n.uncompressedSize;return emitErrorAndAutoClose(e,new Error(g))}}if(e.decodeStrings){if(!e.strictFileNames){n.fileName=n.fileName.replace(/\\/g,"/")}var S=validateFileName(n.fileName,e.validateFileNameOptions);if(S!=null)return emitErrorAndAutoClose(e,new Error(S))}e.emit("entry",n);if(!e.lazyEntries)e._readEntry()}))}))};ZipFile.prototype.openReadStream=function(e,r,t){var i=this;var o=0;var s=e.compressedSize;if(t==null){t=r;r={}}else{if(r.decrypt!=null){if(!e.isEncrypted()){throw new Error("options.decrypt can only be specified for encrypted entries")}if(r.decrypt!==false)throw new Error("invalid options.decrypt value: "+r.decrypt);if(e.isCompressed()){if(r.decompress!==false)throw new Error("entry is encrypted and compressed, and options.decompress !== false")}}if(r.decompress!=null){if(!e.isCompressed()){throw new Error("options.decompress can only be specified for compressed entries")}if(!(r.decompress===false||r.decompress===true)){throw new Error("invalid options.decompress value: "+r.decompress)}}if(r.start!=null||r.end!=null){if(e.isCompressed()&&r.decompress!==false){throw new Error("start/end range not allowed for compressed entry without options.decompress === false")}if(e.isEncrypted()&&r.decrypt!==false){throw new Error("start/end range not allowed for encrypted entry without options.decrypt === false")}}if(r.start!=null){o=r.start;if(o<0)throw new Error("options.start < 0");if(o>e.compressedSize)throw new Error("options.start > entry.compressedSize")}if(r.end!=null){s=r.end;if(s<0)throw new Error("options.end < 0");if(s>e.compressedSize)throw new Error("options.end > entry.compressedSize");if(s<o)throw new Error("options.end < options.start")}}if(!i.isOpen)return t(new Error("closed"));if(e.isEncrypted()){if(r.decrypt!==false)return t(new Error("entry is encrypted, and options.decrypt !== false"))}i.reader.ref();var a=c(30);readAndAssertNoEof(i.reader,a,0,a.length,e.relativeOffsetOfLocalHeader,(function(f){try{if(f)return t(f);var d=a.readUInt32LE(0);if(d!==67324752){return t(new Error("invalid local file header signature: 0x"+d.toString(16)))}var u=a.readUInt16LE(26);var l=a.readUInt16LE(28);var c=e.relativeOffsetOfLocalHeader+a.length+u+l;var p;if(e.compressionMethod===0){p=false}else if(e.compressionMethod===8){p=r.decompress!=null?r.decompress:true}else{return t(new Error("unsupported compression method: "+e.compressionMethod))}var m=c;var h=m+e.compressedSize;if(e.compressedSize!==0){if(h>i.fileSize){return t(new Error("file data overflows file bounds: "+m+" + "+e.compressedSize+" > "+i.fileSize))}}var y=i.reader.createReadStream({start:m+o,end:m+s});var v=y;if(p){var E=false;var w=n.createInflateRaw();y.on("error",(function(e){setImmediate((function(){if(!E)w.emit("error",e)}))}));y.pipe(w);if(i.validateEntrySizes){v=new AssertByteCountStream(e.uncompressedSize);w.on("error",(function(e){setImmediate((function(){if(!E)v.emit("error",e)}))}));w.pipe(v)}else{v=w}v.destroy=function(){E=true;if(w!==v)w.unpipe(v);y.unpipe(w);y.destroy()}}t(null,v)}finally{i.reader.unref()}}))};function Entry(){}Entry.prototype.getLastModDate=function(){return dosDateTimeToDate(this.lastModFileDate,this.lastModFileTime)};Entry.prototype.isEncrypted=function(){return(this.generalPurposeBitFlag&1)!==0};Entry.prototype.isCompressed=function(){return this.compressionMethod===8};function dosDateTimeToDate(e,r){var t=e&31;var n=(e>>5&15)-1;var i=(e>>9&127)+1980;var o=0;var s=(r&31)*2;var a=r>>5&63;var f=r>>11&31;return new Date(i,n,t,f,a,s,o)}function validateFileName(e){if(e.indexOf("\\")!==-1){return"invalid characters in fileName: "+e}if(/^[a-zA-Z]:/.test(e)||/^\//.test(e)){return"absolute path: "+e}if(e.split("/").indexOf("..")!==-1){return"invalid relative path: "+e}return null}function readAndAssertNoEof(e,r,t,n,i,o){if(n===0){return setImmediate((function(){o(null,c(0))}))}e.read(r,t,n,i,(function(e,r){if(e)return o(e);if(r<n){return o(new Error("unexpected EOF"))}o()}))}s.inherits(AssertByteCountStream,f);function AssertByteCountStream(e){f.call(this);this.actualByteCount=0;this.expectedByteCount=e}AssertByteCountStream.prototype._transform=function(e,r,t){this.actualByteCount+=e.length;if(this.actualByteCount>this.expectedByteCount){var n="too many bytes in the stream. expected "+this.expectedByteCount+". got at least "+this.actualByteCount;return t(new Error(n))}t(null,e)};AssertByteCountStream.prototype._flush=function(e){if(this.actualByteCount<this.expectedByteCount){var r="not enough bytes in the stream. expected "+this.expectedByteCount+". got only "+this.actualByteCount;return e(new Error(r))}e()};s.inherits(RandomAccessReader,a);function RandomAccessReader(){a.call(this);this.refCount=0}RandomAccessReader.prototype.ref=function(){this.refCount+=1};RandomAccessReader.prototype.unref=function(){var e=this;e.refCount-=1;if(e.refCount>0)return;if(e.refCount<0)throw new Error("invalid unref");e.close(onCloseDone);function onCloseDone(r){if(r)return e.emit("error",r);e.emit("close")}};RandomAccessReader.prototype.createReadStream=function(e){var r=e.start;var t=e.end;if(r===t){var n=new d;setImmediate((function(){n.end()}));return n}var i=this._readStreamForRange(r,t);var o=false;var s=new RefUnrefFilter(this);i.on("error",(function(e){setImmediate((function(){if(!o)s.emit("error",e)}))}));s.destroy=function(){i.unpipe(s);s.unref();i.destroy()};var a=new AssertByteCountStream(t-r);s.on("error",(function(e){setImmediate((function(){if(!o)a.emit("error",e)}))}));a.destroy=function(){o=true;s.unpipe(a);s.destroy()};return i.pipe(s).pipe(a)};RandomAccessReader.prototype._readStreamForRange=function(e,r){throw new Error("not implemented")};RandomAccessReader.prototype.read=function(e,r,t,n,i){var o=this.createReadStream({start:n,end:n+t});var s=new u;var a=0;s._write=function(t,n,i){t.copy(e,r+a,0,t.length);a+=t.length;i()};s.on("finish",i);o.on("error",(function(e){i(e)}));o.pipe(s)};RandomAccessReader.prototype.close=function(e){setImmediate(e)};s.inherits(RefUnrefFilter,d);function RefUnrefFilter(e){d.call(this);this.context=e;this.context.ref();this.unreffedYet=false}RefUnrefFilter.prototype._flush=function(e){this.unref();e()};RefUnrefFilter.prototype.unref=function(e){if(this.unreffedYet)return;this.unreffedYet=true;this.context.unref()};var l="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ";function decodeBuffer(e,r,t,n){if(n){return e.toString("utf8",r,t)}else{var i="";for(var o=r;o<t;o++){i+=l[e[o]]}return i}}function readUInt64LE(e,r){var t=e.readUInt32LE(r);var n=e.readUInt32LE(r+4);return n*4294967296+t}var c;if(typeof Buffer.allocUnsafe==="function"){c=function(e){return Buffer.allocUnsafe(e)}}else{c=function(e){return new Buffer(e)}}function defaultCallback(e){if(e)throw e}})();module.exports=t})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"yauzl","version":"2.10.0","description":"yet another unzip library for node","main":"index.js","scripts":{"test":"node test/test.js","test-cov":"istanbul cover test/test.js","test-travis":"istanbul cover --report lcovonly test/test.js"},"repository":{"type":"git","url":"https://github.com/thejoshwolfe/yauzl.git"},"keywords":["unzip","zip","stream","archive","file"],"author":"Josh Wolfe <thejoshwolfe@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/thejoshwolfe/yauzl/issues"},"homepage":"https://github.com/thejoshwolfe/yauzl","dependencies":{"fd-slicer":"~1.1.0","buffer-crc32":"~0.2.3"},"devDependencies":{"bl":"~1.0.0","istanbul":"~0.3.4","pend":"~1.2.0"},"files":["index.js"],"_lastModified":"2026-11-22T14:30:02.458Z"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Application } from '@nocobase/server';
|
|
2
|
+
import { Manifest } from './package-format';
|
|
3
|
+
export interface TransferableCollection {
|
|
4
|
+
name: string;
|
|
5
|
+
title: string;
|
|
6
|
+
template: string;
|
|
7
|
+
supported: boolean;
|
|
8
|
+
unsupportedReason?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ExportOptions {
|
|
11
|
+
collections: string[];
|
|
12
|
+
includeData: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ExportResult {
|
|
15
|
+
filePath: string;
|
|
16
|
+
fileName: string;
|
|
17
|
+
manifest: Manifest;
|
|
18
|
+
}
|
|
19
|
+
/** Package names (or names) of the plugins enabled in this app, from the plugin manager. */
|
|
20
|
+
export declare function enabledPluginNames(app: Application): string[];
|
|
21
|
+
export declare class CollectionExporter {
|
|
22
|
+
private app;
|
|
23
|
+
constructor(app: Application);
|
|
24
|
+
private get db();
|
|
25
|
+
/** Collections a user may pick for export, with a flag for the ones the PoC cannot transfer. */
|
|
26
|
+
listCollections(): Promise<TransferableCollection[]>;
|
|
27
|
+
export(options: ExportOptions): Promise<ExportResult>;
|
|
28
|
+
private collectionRows;
|
|
29
|
+
private fieldRowsOf;
|
|
30
|
+
/**
|
|
31
|
+
* Expands the selection with the collections it cannot work without: user-defined through collections of
|
|
32
|
+
* belongsToMany fields become companions; auto-created through collections are listed separately because the
|
|
33
|
+
* belongsToMany hook recreates them on import.
|
|
34
|
+
*/
|
|
35
|
+
private resolveSelection;
|
|
36
|
+
private buildPayloads;
|
|
37
|
+
private fieldPayload;
|
|
38
|
+
/** Adapted from plugin-backup-restore Dumper.dumpCollection: meta always, rows only when includeData. */
|
|
39
|
+
private dumpCollection;
|
|
40
|
+
private writeJson;
|
|
41
|
+
private zipDir;
|
|
42
|
+
}
|