@@ -4,7 +4,8 @@ import http from 'node:http'
4
4
import { tmpdir } from 'node:os'
5
5
import { dirname , join , relative , resolve , sep } from 'node:path'
6
6
import { platform } from 'node:process'
7
- import { promises as stream } from 'node:stream'
7
+ import stream from 'node:stream'
8
+ import { promisify } from 'node:util'
8
9
9
10
import { ListResponse } from './backend/list.ts'
10
11
import { decodeMetadata , encodeMetadata , METADATA_HEADER_INTERNAL } from './metadata.ts'
@@ -22,6 +23,10 @@ export enum Operation {
22
23
SET = 'set' ,
23
24
}
24
25
26
+ // TODO: Replace with `promises` import of `node:stream` once we can drop
27
+ // support for Node 14.
28
+ const pipeline = promisify ( stream . pipeline )
29
+
25
30
interface BlobsServerOptions {
26
31
/**
27
32
* Whether debug-level information should be logged, such as internal errors
@@ -272,7 +277,7 @@ export class BlobsServer {
272
277
const tempDataPath = join ( tempDirectory , relativeDataPath )
273
278
274
279
await fs . mkdir ( dirname ( tempDataPath ) , { recursive : true } )
275
- await stream . pipeline ( req , createWriteStream ( tempDataPath ) )
280
+ await pipeline ( req , createWriteStream ( tempDataPath ) )
276
281
277
282
await fs . mkdir ( dirname ( dataPath ) , { recursive : true } )
278
283
await fs . copyFile ( tempDataPath , dataPath )
0 commit comments