Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/progress custom #463

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 49 additions & 42 deletions manual_tests/upload_new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,43 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as Path from 'path';

// import { Client } from './../src/lib/client';
// import * as Path from 'path';
// import * as Sentry from '@sentry/node';

import { S3Uploader } from './../src/lib/api/upload/uploaders/s3';
import { getFile } from '../src/lib/api/upload';
import { S3Uploader } from './../src/lib/api/upload/uploaders/s3';
import { Client } from './../src/lib/client';

// import * as Sentry from '@sentry/node';

const createFile = (size = 10 * 1024 * 1024) => Buffer.alloc(size).fill('a');
// Sentry.init({ dsn: 'DSN' });

// const fs = new Client(process.env.API_KEY);
const fs = new Client(process.env.API_KEY);
// fs.on('upload.error', (e) => {
// console.log('uploadError', e);
// });

// fs.multiupload(
// [
// {
// file: Path.resolve(__dirname, './manual_10mb.mp4'),
// name: 'test.mp4',
// },
// ],
// {},
// {
// filename: () => 'test2.mp4',
// }
// ).then(res => {
// console.dir(res, { depth: null });
// });
(async () => {
const file1 = createFile(5 * 1024 * 1024);
const file2 = createFile(2 * 1024 * 1024);

fs.multiupload(
[ { file: file1, name: 'test1' }, { file: file2, name: 'test 2' } ],
{
onProgress: (e) => {
console.log('prog', e);
if (e.files) {
Object.keys(e.files).forEach(f => console.log(e.files[f]));
}
},
}
// {
// filename: () => 'test2.mp4',
// }
).then(res => {
console.dir(res, { depth: null });
});
})();

// try {
// fs.upload('./upload.js').then((res) => {
Expand All @@ -53,30 +60,30 @@ const createFile = (size = 10 * 1024 * 1024) => Buffer.alloc(size).fill('a');
// console.log(e.details);
// }

const b64jpg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD//gA+Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyB2NjIpLCBkZWZhdWx0IHF1YWxpdHkK/9sAQwAIBgYHBgUIBwcHCQkICgwUDQwLCwwZEhMPFB0aHx4dGhwcICQuJyAiLCMcHCg3KSwwMTQ0NB8nOT04MjwuMzQy/9sAQwEJCQkMCwwYDQ0YMiEcITIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy/8AAEQgAlgCWAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A4iLw5ozW+ms1wSs2DLc/2jCu9/LZvJ8krvh+cCPzXJQffxtIFZes6dodvLeRyXN7bXEY/cW8Xk30bfICN1wki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AF74er6jo154d060s7H7PewY85jAMscYYiUMCwJCttZCVJYBtuBRRTER22tabD4Qk0u6heWYTTyJGbaMqTJHGqMJSd8ZRk3EKMPgKeCaZ46s7SzsdG2afDa3moRvqsnkMGj2ThNiL8qlVUo+EO4KG4ZsnBRQA228exweEIPDV3DNdaTHaqJbLCosswvRMT5g+dVMWUyOhPTvWRHrnht9fnmuYH+xy6bNaySx6TbhppnDBJRAHCQFNyco2T5WeDI2CimBVbxHor6lpw/sK0SztreFXkW3HmmcW4jeVlLbJR5gD7GwreWM7TJIW6vT/h5e/E6W68Q+Gl07TtPDRWxt7k+UwlSCLzDiKPZgsScgLnJO1elFFAIyofGOkXvxF1LXNV01JrKZ5jaqLKHMeZC6NLFwsxIJVtzbsMSHDKpBd6v4am8KXFhZ6Z5N8bppI5jag7l35Uq/m74/kYqY2MqnYpBDFmJRWUzeJzIFPJwKKK5DsQz+En1qMtzRRVIQxutFFFWSf/Z';

(async () => {
// const file = await getFile(createFile());
const file = await getFile(b64jpg);
// file.name = 'test.txt';
console.log('Uploadinf file', file.size);
// const token = new FsCancelToken();
// (async () => {
// // const file = await getFile(createFile());
// const file = await getFile(b64jpg);
// // file.name = 'test.txt';
// console.log('Uploadinf file', file.size);
// // const token = new FsCancelToken();

const u = new S3Uploader({});
u.setUrl('https://upload.filestackapi.com');
u.setApikey(process.env.API_KEY);
// u.setIntegrityCheck(false);
u.addFile(file);
// u.addFile(file1);
// const u = new S3Uploader({});
// u.setUrl('https://upload.filestackapi.com');
// u.setApikey(process.env.API_KEY);
// // u.setIntegrityCheck(false);
// u.addFile(file);
// // u.addFile(file1);

// setTimeout(() => {
// console.log('abort call');
// u.abort();
// }, 3000);
// // setTimeout(() => {
// // console.log('abort call');
// // u.abort();
// // }, 3000);

const res = await u.execute().catch((e) => {
console.log('ERROR', e);
});
// const res = await u.execute().catch((e) => {
// console.log('ERROR', e);
// });

console.log(res);
})();
// console.log(res);
// })();
3 changes: 3 additions & 0 deletions src/lib/api/upload/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ export class File {

public uploadTags: UploadTags;

public originalName: string;

constructor(private readonly _file: FileInstance, private readonly _sanitizeOptions?: SanitizeOptions) {
this.originalName = this._file.name + '';
this._file.name = sanitizeName(this._file.name, this._sanitizeOptions);
}

Expand Down
Loading