Example #1
0
export const uploadFromStream = toPath => async (fromStream) => {
  const serviceUrl = getServiceUrl();
  const blobName = getPrefixedPath(toPath);
  const containerURL = ContainerURL.fromServiceURL(serviceUrl, containerName);

  const blobUrl = BlobURL.fromContainerURL(containerURL, blobName);
  const blockBlobURL = BlockBlobURL.fromBlobURL(blobUrl);

  return uploadStreamToBlockBlob(Aborter.none, fromStream, blockBlobURL, BUFFER_SIZE, MAX_BUFFERS);
};
Example #2
0
export const downloadToStream = fromPath => async (toStream) => {
  const serviceUrl = getServiceUrl();
  const blobName = getPrefixedPath(fromPath);
  const containerURL = ContainerURL.fromServiceURL(serviceUrl, containerName);

  const blobUrl = BlobURL.fromContainerURL(containerURL, blobName);

  const downloadBlockBlobResponse = await blobUrl.download(Aborter.none, 0);

  downloadBlockBlobResponse.readableStreamBody.pipe(toStream);
};