058d1ee52f19317bd3148c216e31ea9fbb007323
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
;
30 /******/ // Create a new module (and put it into the cache)
31 /******/ var module
= installedModules
[moduleId
] = {
37 /******/ // Execute the module function
38 /******/ modules
[moduleId
].call(module
.exports
, module
, module
.exports
, __webpack_require__
);
40 /******/ // Flag the module as loaded
41 /******/ module
.l
= true;
43 /******/ // Return the exports of the module
44 /******/ return module
.exports
;
48 /******/ // expose the modules object (__webpack_modules__)
49 /******/ __webpack_require__
.m
= modules
;
51 /******/ // expose the module cache
52 /******/ __webpack_require__
.c
= installedModules
;
54 /******/ // identity function for calling harmony imports with the correct context
55 /******/ __webpack_require__
.i = function(value
) { return value
; };
57 /******/ // define getter function for harmony exports
58 /******/ __webpack_require__
.d = function(exports
, name
, getter
) {
59 /******/ if(!__webpack_require__
.o(exports
, name
)) {
60 /******/ Object
.defineProperty(exports
, name
, {
61 /******/ configurable
: false,
62 /******/ enumerable
: true,
68 /******/ // getDefaultExport function for compatibility with non-harmony modules
69 /******/ __webpack_require__
.n = function(module
) {
70 /******/ var getter
= module
&& module
.__esModule
?
71 /******/ function getDefault() { return module
['default']; } :
72 /******/ function getModuleExports() { return module
; };
73 /******/ __webpack_require__
.d(getter
, 'a', getter
);
74 /******/ return getter
;
77 /******/ // Object.prototype.hasOwnProperty.call
78 /******/ __webpack_require__
.o = function(object
, property
) { return Object
.prototype.hasOwnProperty
.call(object
, property
); };
80 /******/ // __webpack_public_path__
81 /******/ __webpack_require__
.p
= "";
83 /******/ // Load entry module and return exports
84 /******/ return __webpack_require__(__webpack_require__
.s
= 2);
86 /************************************************************************/
89 /***/ (function(module
, exports
) {
93 * MIT (c) 2011 T. Jameson Little
100 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
101 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
102 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
103 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
104 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
105 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
106 'w', 'x', 'y', 'z', '0', '1', '2', '3',
107 '4', '5', '6', '7', '8', '9', '+', '/'
109 function clean(length
) {
110 var i
, buffer
= new Uint8Array(length
);
111 for (i
= 0; i
< length
; i
+= 1) {
117 function extend(orig
, length
, addLength
, multipleOf
) {
118 var newSize
= length
+ addLength
,
119 buffer
= clean((parseInt(newSize
/ multipleOf
) + 1) * multipleOf
);
126 function pad(num
, bytes
, base
) {
127 num
= num
.toString(base
|| 8);
128 return "000000000000".substr(num
.length
+ 12 - bytes
) + num
;
131 function stringToUint8 (input
, out
, offset
) {
134 out
= out
|| clean(input
.length
);
136 offset
= offset
|| 0;
137 for (i
= 0, length
= input
.length
; i
< length
; i
+= 1) {
138 out
[offset
] = input
.charCodeAt(i
);
145 function uint8ToBase64(uint8
) {
147 extraBytes
= uint8
.length
% 3, // if we have 1 byte left, pad 2 bytes
151 function tripletToBase64 (num
) {
152 return lookup
[num
>> 18 & 0x3F] + lookup
[num
>> 12 & 0x3F] + lookup
[num
>> 6 & 0x3F] + lookup
[num
& 0x3F];
155 // go through the array every three bytes, we'll deal with trailing stuff later
156 for (i
= 0, length
= uint8
.length
- extraBytes
; i
< length
; i
+= 3) {
157 temp
= (uint8
[i
] << 16) + (uint8
[i
+ 1] << 8) + (uint8
[i
+ 2]);
158 output
+= tripletToBase64(temp
);
161 // this prevents an ERR_INVALID_URL in Chrome (Firefox okay)
162 switch (output
.length
% 4) {
176 module
.exports
.clean
= clean
;
177 module
.exports
.pad
= pad
;
178 module
.exports
.extend
= extend
;
179 module
.exports
.stringToUint8
= stringToUint8
;
180 module
.exports
.uint8ToBase64
= uint8ToBase64
;
186 /***/ (function(module
, exports
, __webpack_require__
) {
190 * MIT (c) 2011 T. Jameson Little
197 struct posix_header { // byte offset
202 char size[12]; // 124
203 char mtime[12]; // 136
204 char chksum[8]; // 148
205 char typeflag; // 156
206 char linkname[100]; // 157
207 char magic[6]; // 257
208 char version[2]; // 263
209 char uname[32]; // 265
210 char gname[32]; // 297
211 char devmajor[8]; // 329
212 char devminor[8]; // 337
213 char prefix[155]; // 345
218 var utils
= __webpack_require__(0),
271 'field': 'majorNumber',
275 'field': 'minorNumber',
279 'field': 'filenamePrefix',
288 function formatHeader(data
, cb
) {
289 var buffer
= utils
.clean(512),
292 headerFormat
.forEach(function (value
) {
293 var str
= data
[value
.field
] || "",
296 for (i
= 0, length
= str
.length
; i
< length
; i
+= 1) {
297 buffer
[offset
] = str
.charCodeAt(i
);
301 offset
+= value
.length
- i
; // space it out with nulls
304 if (typeof cb
=== 'function') {
305 return cb(buffer
, offset
);
310 module
.exports
.structure
= headerFormat
;
311 module
.exports
.format
= formatHeader
;
317 /***/ (function(module
, exports
, __webpack_require__
) {
321 * MIT (c) 2011 T. Jameson Little
327 var header
= __webpack_require__(1),
328 utils
= __webpack_require__(0),
332 function Tar(recordsPerBlock
) {
334 blockSize
= (recordsPerBlock
|| 20) * recordSize
;
335 this.out
= utils
.clean(blockSize
);
338 Tar
.prototype.append = function (filepath
, input
, opts
, callback
) {
347 if (typeof input
=== 'string') {
348 input
= utils
.stringToUint8(input
);
349 } else if (input
.constructor !== Uint8Array
.prototype.constructor) {
350 throw 'Invalid input type. You gave me: ' + input
.constructor.toString().match(/function\s*([$A-Za-z_][0-9A-Za-z_]*)\s*\(/)[1];
353 if (typeof opts
=== 'function') {
360 mode
= opts
.mode
|| parseInt('777', 8) & 0xfff;
361 mtime
= opts
.mtime
|| Math
.floor(+new Date() / 1000);
367 fileMode
: utils
.pad(mode
, 7),
368 uid
: utils
.pad(uid
, 7),
369 gid
: utils
.pad(gid
, 7),
370 fileSize
: utils
.pad(input
.length
, 11),
371 mtime
: utils
.pad(mtime
, 11),
373 type
: opts
.type
|| '0',
375 owner
: opts
.owner
|| '',
376 group
: opts
.group
|| ''
379 // calculate the checksum
381 Object
.keys(data
).forEach(function (key
) {
382 var i
, value
= data
[key
], length
;
384 for (i
= 0, length
= value
.length
; i
< length
; i
+= 1) {
385 checksum
+= value
.charCodeAt(i
);
389 data
.checksum
= utils
.pad(checksum
, 6) + "\u0000 ";
391 headerArr
= header
.format(data
);
393 var i
, offset
, length
;
395 this.out
.set(headerArr
, this.written
);
397 this.written
+= headerArr
.length
;
399 // If there is not enough space in this.out, we need to expand it to
400 // fit the new input.
401 if (this.written
+ input
.length
> this.out
.length
) {
402 this.out
= utils
.extend(this.out
, this.written
, input
.length
, blockSize
);
405 this.out
.set(input
, this.written
);
407 // to the nearest multiple of recordSize
408 this.written
+= input
.length
+ (recordSize
- (input
.length
% recordSize
|| recordSize
));
410 // make sure there's at least 2 empty records worth of extra space
411 if (this.out
.length
- this.written
< recordSize
* 2) {
412 this.out
= utils
.extend(this.out
, this.written
, recordSize
* 2, blockSize
);
415 if (typeof callback
=== 'function') {
422 Tar
.prototype.clear = function () {
424 this.out
= utils
.clean(blockSize
);
427 module
.exports
= Tar
;