MCPcopy Index your code
hub / github.com/cameri/nostream / createImportStream

Function createImportStream

src/import-events.ts:173–201  ·  view source on GitHub ↗
(inputFile: InputFileSpec)

Source from the content-addressed store, hash-verified

171}
172
173const createImportStream = (inputFile: InputFileSpec): NodeJS.ReadableStream => {
174 const source = fs.createReadStream(inputFile.absolutePath)
175
176 if (!inputFile.compressionFormat) {
177 return source
178 }
179
180 const decompressor = createDecompressionStream(inputFile.compressionFormat)
181
182 source.on('error', (error) => {
183 if (!decompressor.destroyed) {
184 decompressor.destroy(error)
185 }
186 })
187
188 decompressor.on('close', () => {
189 if (!source.destroyed) {
190 source.destroy()
191 }
192 })
193
194 decompressor.on('error', () => {
195 if (!source.destroyed) {
196 source.destroy()
197 }
198 })
199
200 return source.pipe(decompressor)
201}
202
203export const runImportEvents = async (
204 args: string[] = process.argv.slice(2),

Callers 1

runImportEventsFunction · 0.85

Calls 1

Tested by

no test coverage detected