diff --git a/src/upload/adapters/browser.js b/src/upload/adapters/browser.js index ad610ab..73dcd87 100644 --- a/src/upload/adapters/browser.js +++ b/src/upload/adapters/browser.js @@ -1,4 +1,4 @@ -function uploadToS3(file, url, { onProgress }) { +export function uploadToS3(file, url, { onProgress }) { const xhr = new XMLHttpRequest(); const promise = new Promise((resolve, reject) => { diff --git a/src/upload/adapters/node.js b/src/upload/adapters/node.js index dc0ab54..2a02728 100644 --- a/src/upload/adapters/node.js +++ b/src/upload/adapters/node.js @@ -1,7 +1,9 @@ import url from 'url'; import fs from 'fs'; import remote from './nodeRemote'; -import local from './nodeLocal'; +import local, { uploadToS3 } from './nodeLocal'; + +export { uploadToS3 }; export default function node(client, source, options = {}) { const { host } = url.parse(source); diff --git a/src/upload/adapters/nodeLocal.js b/src/upload/adapters/nodeLocal.js index 6bdc489..a4aa356 100644 --- a/src/upload/adapters/nodeLocal.js +++ b/src/upload/adapters/nodeLocal.js @@ -3,7 +3,7 @@ import path from 'path'; import fs from 'fs'; import mime from 'mime-types'; -function uploadToS3(url, filePath, { onProgress }) { +export function uploadToS3(filePath, url, { onProgress }) { const totalLength = fs.statSync(filePath).size; let isCancelled = false; const promise = got.put(url, { @@ -60,8 +60,8 @@ export default function nodeLocal(client, filePath, options) { }); } const { promise: uploadPromise, cancel: cancelUpload } = uploadToS3( - url, filePath, + url, { onProgress: options.onProgress, },