2 Copyright 2020 TATA ELXSI
4 Licensed under the Apache License, Version 2.0 (the 'License');
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
16 Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
19 /******/ (function (modules
) { // webpackBootstrap
20 /******/ // The module cache
21 /******/ var installedModules
= {};
23 /******/ // The require function
24 /******/ function __webpack_require__(moduleId
) {
26 /******/ // Check if module is in cache
27 /******/ if (installedModules
[moduleId
]) {
28 /******/ return installedModules
[moduleId
].exports
;
31 /******/ // Create a new module (and put it into the cache)
32 /******/ var module
= installedModules
[moduleId
] = {
39 /******/ // Execute the module function
40 /******/ modules
[moduleId
].call(module
.exports
, module
, module
.exports
, __webpack_require__
);
42 /******/ // Flag the module as loaded
43 /******/ module
.l
= true;
45 /******/ // Return the exports of the module
46 /******/ return module
.exports
;
51 /******/ // expose the modules object (__webpack_modules__)
52 /******/ __webpack_require__
.m
= modules
;
54 /******/ // expose the module cache
55 /******/ __webpack_require__
.c
= installedModules
;
57 /******/ // identity function for calling harmony imports with the correct context
58 /******/ __webpack_require__
.i = function (value
) { return value
; };
60 /******/ // define getter function for harmony exports
61 /******/ __webpack_require__
.d = function (exports
, name
, getter
) {
62 /******/ if (!__webpack_require__
.o(exports
, name
)) {
63 /******/ Object
.defineProperty(exports
, name
, {
64 /******/ configurable
: false,
65 /******/ enumerable
: true,
74 /******/ // getDefaultExport function for compatibility with non-harmony modules
75 /******/ __webpack_require__
.n = function (module
) {
76 /******/ var getter
= module
&& module
.__esModule
?
77 /******/ function getDefault() { return module
['default']; } :
78 /******/ function getModuleExports() { return module
; };
79 /******/ __webpack_require__
.d(getter
, 'a', getter
);
80 /******/ return getter
;
84 /******/ // Object.prototype.hasOwnProperty.call
85 /******/ __webpack_require__
.o = function (object
, property
) { return Object
.prototype.hasOwnProperty
.call(object
, property
); };
87 /******/ // __webpack_public_path__
88 /******/ __webpack_require__
.p
= "";
90 /******/ // Load entry module and return exports
91 /******/ return __webpack_require__(__webpack_require__
.s
= 2);
94 /************************************************************************/
97 /***/ (function (module
, exports
) {
101 * MIT (c) 2011 T. Jameson Little
108 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
109 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
110 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
111 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
112 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
113 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
114 'w', 'x', 'y', 'z', '0', '1', '2', '3',
115 '4', '5', '6', '7', '8', '9', '+', '/'
117 function clean(length
) {
118 var i
, buffer
= new Uint8Array(length
);
119 for (i
= 0; i
< length
; i
+= 1) {
125 function extend(orig
, length
, addLength
, multipleOf
) {
126 var newSize
= length
+ addLength
,
127 buffer
= clean((parseInt(newSize
/ multipleOf
) + 1) * multipleOf
);
134 function pad(num
, bytes
, base
) {
135 num
= num
.toString(base
|| 8);
136 return "000000000000".substr(num
.length
+ 12 - bytes
) + num
;
139 function stringToUint8(input
, out
, offset
) {
142 out
= out
|| clean(input
.length
);
144 offset
= offset
|| 0;
145 for (i
= 0, length
= input
.length
; i
< length
; i
+= 1) {
146 out
[offset
] = input
.charCodeAt(i
);
153 function uint8ToBase64(uint8
) {
155 extraBytes
= uint8
.length
% 3, // if we have 1 byte left, pad 2 bytes
159 function tripletToBase64(num
) {
160 return lookup
[num
>> 18 & 0x3F] + lookup
[num
>> 12 & 0x3F] + lookup
[num
>> 6 & 0x3F] + lookup
[num
& 0x3F];
163 // go through the array every three bytes, we'll deal with trailing stuff later
164 for (i
= 0, length
= uint8
.length
- extraBytes
; i
< length
; i
+= 3) {
165 temp
= (uint8
[i
] << 16) + (uint8
[i
+ 1] << 8) + (uint8
[i
+ 2]);
166 output
+= tripletToBase64(temp
);
169 // this prevents an ERR_INVALID_URL in Chrome (Firefox okay)
170 switch (output
.length
% 4) {
184 module
.exports
.clean
= clean
;
185 module
.exports
.pad
= pad
;
186 module
.exports
.extend
= extend
;
187 module
.exports
.stringToUint8
= stringToUint8
;
188 module
.exports
.uint8ToBase64
= uint8ToBase64
;
195 /***/ (function (module
, exports
, __webpack_require__
) {
199 * MIT (c) 2011 T. Jameson Little
206 struct posix_header { // byte offset
211 char size[12]; // 124
212 char mtime[12]; // 136
213 char chksum[8]; // 148
214 char typeflag; // 156
215 char linkname[100]; // 157
216 char magic[6]; // 257
217 char version[2]; // 263
218 char uname[32]; // 265
219 char gname[32]; // 297
220 char devmajor[8]; // 329
221 char devminor[8]; // 337
222 char prefix[155]; // 345
227 var utils
= __webpack_require__(0),
280 'field': 'majorNumber',
284 'field': 'minorNumber',
288 'field': 'filenamePrefix',
297 function formatHeader(data
, cb
) {
298 var buffer
= utils
.clean(512),
301 headerFormat
.forEach(function (value
) {
302 var str
= data
[value
.field
] || "",
305 for (i
= 0, length
= str
.length
; i
< length
; i
+= 1) {
306 buffer
[offset
] = str
.charCodeAt(i
);
310 offset
+= value
.length
- i
; // space it out with nulls
313 if (typeof cb
=== 'function') {
314 return cb(buffer
, offset
);
319 module
.exports
.structure
= headerFormat
;
320 module
.exports
.format
= formatHeader
;
327 /***/ (function (module
, exports
, __webpack_require__
) {
331 * MIT (c) 2011 T. Jameson Little
337 var header
= __webpack_require__(1),
338 utils
= __webpack_require__(0),
342 function Tar(recordsPerBlock
) {
344 blockSize
= (recordsPerBlock
|| 20) * recordSize
;
345 this.out
= utils
.clean(blockSize
);
348 Tar
.prototype.append = function (filepath
, input
, opts
, callback
) {
357 if (typeof input
=== 'string') {
358 input
= utils
.stringToUint8(input
);
359 } else if (input
.constructor !== Uint8Array
.prototype.constructor) {
360 throw 'Invalid input type. You gave me: ' + input
.constructor.toString().match(/function\s*([$A-Za-z_][0-9A-Za-z_]*)\s*\(/)[1];
363 if (typeof opts
=== 'function') {
370 mode
= opts
.mode
|| parseInt('777', 8) & 0xfff;
371 mtime
= opts
.mtime
|| Math
.floor(+new Date() / 1000);
377 fileMode
: utils
.pad(mode
, 7),
378 uid
: utils
.pad(uid
, 7),
379 gid
: utils
.pad(gid
, 7),
380 fileSize
: utils
.pad(input
.length
, 11),
381 mtime
: utils
.pad(mtime
, 11),
383 type
: opts
.type
|| '0',
385 owner
: opts
.owner
|| '',
386 group
: opts
.group
|| '',
387 linkName
: opts
.linkname
|| ''
390 // calculate the checksum
392 Object
.keys(data
).forEach(function (key
) {
393 var i
, value
= data
[key
], length
;
395 for (i
= 0, length
= value
.length
; i
< length
; i
+= 1) {
396 checksum
+= value
.charCodeAt(i
);
400 data
.checksum
= utils
.pad(checksum
, 6) + "\u0000 ";
402 headerArr
= header
.format(data
);
404 var i
, offset
, length
;
406 this.out
.set(headerArr
, this.written
);
408 this.written
+= headerArr
.length
;
410 // If there is not enough space in this.out, we need to expand it to
411 // fit the new input.
412 if (this.written
+ input
.length
> this.out
.length
) {
413 this.out
= utils
.extend(this.out
, this.written
, input
.length
, blockSize
);
416 this.out
.set(input
, this.written
);
418 // to the nearest multiple of recordSize
419 this.written
+= input
.length
+ (recordSize
- (input
.length
% recordSize
|| recordSize
));
421 // make sure there's at least 2 empty records worth of extra space
422 if (this.out
.length
- this.written
< recordSize
* 2) {
423 this.out
= utils
.extend(this.out
, this.written
, recordSize
* 2, blockSize
);
426 if (typeof callback
=== 'function') {
433 Tar
.prototype.clear = function () {
435 this.out
= utils
.clean(blockSize
);
438 module
.exports
= Tar
;