UNPKG

@strapi/data-transfer

Version:

Data transfer capabilities for Strapi

26 lines 1.35 kB
import { Writable } from 'stream'; import type { Core } from '@strapi/types'; import type { Transaction } from '../../../types/utils'; export interface CreateAssetsDestinationWritableOptions { strapi: Core.Strapi; transaction: Transaction; resolveUploadFileId: (metadata: { id: number; }) => number | undefined; restoreMediaEntitiesContent: boolean; removeAssetsBackup: () => Promise<void>; } /** * Writable for restoring upload assets during a local push destination transfer. * * Design constraints: * 1. The `write()` callback must return **before** `uploadStream` finishes so the remote push * handler can continue feeding chunks to the PassThrough stream in the same WebSocket batch * (avoids deadlock — see `streamAsset` in the remote push handler). * 2. `uploadStream` is only called **after** the PassThrough has been fully drained (all chunks * received and the stream ended). This gives the upload provider a pre-filled synchronous * Readable rather than a lazy async wrapper, which avoids `Buffer.from(undefined)` crashes * in upload providers that call `stream.read()` before any data has been buffered. */ export declare function createAssetsDestinationWritable(options: CreateAssetsDestinationWritableOptions): Writable; //# sourceMappingURL=assets-destination-writable.d.ts.map