MCPcopy
hub / github.com/directus/directus / createStream

Function createStream

packages/storage-driver-cloudinary/src/index.test.ts:886–899  ·  view source on GitHub ↗
(chunks?: Buffer[])

Source from the content-addressed store, hash-verified

884
885describe('#write', () => {
886 const createStream = (chunks?: Buffer[]): PassThrough => {
887 chunks = chunks ?? randUnique({ length: randNumber({ min: 1, max: 10 }) }).map((str: string) => Buffer.from(str));
888
889 const stream = new PassThrough();
890
891 for (const chunk of chunks!) {
892 stream.emit('data', chunk);
893 }
894
895 stream.end();
896 stream.destroy();
897
898 return stream;
899 };
900
901 // NOTE: Blob's can't be converted to Strings by `vitest`, so any `.toEqual()` or
902 // `.hasBeenCalledWith` uses against the params of the function call will error with a

Callers 1

index.test.tsFile · 0.85

Calls 1

fromMethod · 0.80

Tested by

no test coverage detected