No Description

File.js 639B

12345678910111213141516171819202122232425262728
  1. // Copyright 2016 wkh237@github. All rights reserved.
  2. // Use of this source code is governed by a MIT-style license that can be
  3. // found in the LICENSE file.
  4. import Blob from './Blob.js'
  5. export default class File extends Blob {
  6. name : string = '';
  7. static build(name:string, data:any, cType:string):Promise<File> {
  8. return new Promise((resolve, reject) => {
  9. if (data === undefined) {
  10. reject(new TypeError('data is undefined'))
  11. }
  12. new File(data, cType).onCreated((f) => {
  13. f.name = name
  14. resolve(f)
  15. })
  16. })
  17. }
  18. constructor(data:any , cType:string) {
  19. super(data, cType)
  20. }
  21. }