123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
-
-
-
-
- var File = function (name, localURL, type, lastModifiedDate, size) {
- this.name = name || '';
- this.localURL = localURL || null;
- this.type = type || null;
- this.lastModified = lastModifiedDate || null;
-
- this.lastModifiedDate = lastModifiedDate || null;
- this.size = size || 0;
-
-
- this.start = 0;
- this.end = this.size;
- };
-
-
- File.prototype.slice = function (start, end) {
- var size = this.end - this.start;
- var newStart = 0;
- var newEnd = size;
- if (arguments.length) {
- if (start < 0) {
- newStart = Math.max(size + start, 0);
- } else {
- newStart = Math.min(size, start);
- }
- }
-
- if (arguments.length >= 2) {
- if (end < 0) {
- newEnd = Math.max(size + end, 0);
- } else {
- newEnd = Math.min(end, size);
- }
- }
-
- var newFile = new File(this.name, this.localURL, this.type, this.lastModified, this.size);
- newFile.start = this.start + newStart;
- newFile.end = this.start + newEnd;
- return newFile;
- };
-
- module.exports = File;
|