summaryrefslogtreecommitdiff
path: root/std/archive/tar.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/archive/tar.ts')
-rw-r--r--std/archive/tar.ts64
1 files changed, 35 insertions, 29 deletions
diff --git a/std/archive/tar.ts b/std/archive/tar.ts
index 8ebfa7fb5..f33ea69a4 100644
--- a/std/archive/tar.ts
+++ b/std/archive/tar.ts
@@ -384,26 +384,28 @@ export class Tar {
*/
getReader(): Deno.Reader {
const readers: Deno.Reader[] = [];
- this.data.forEach((tarData): void => {
- let { reader } = tarData;
- const { filePath } = tarData;
- const headerArr = formatHeader(tarData);
- readers.push(new Deno.Buffer(headerArr));
- if (!reader) {
- reader = new FileReader(filePath!);
- }
- readers.push(reader);
-
- // to the nearest multiple of recordSize
- readers.push(
- new Deno.Buffer(
- clean(
- recordSize -
- (parseInt(tarData.fileSize!, 8) % recordSize || recordSize)
+ this.data.forEach(
+ (tarData): void => {
+ let { reader } = tarData;
+ const { filePath } = tarData;
+ const headerArr = formatHeader(tarData);
+ readers.push(new Deno.Buffer(headerArr));
+ if (!reader) {
+ reader = new FileReader(filePath!);
+ }
+ readers.push(reader);
+
+ // to the nearest multiple of recordSize
+ readers.push(
+ new Deno.Buffer(
+ clean(
+ recordSize -
+ (parseInt(tarData.fileSize!, 8) % recordSize || recordSize)
+ )
)
- )
- );
- });
+ );
+ }
+ );
// append 2 empty records
readers.push(new Deno.Buffer(clean(recordSize * 2)));
@@ -460,18 +462,22 @@ export class Untar {
"mtime",
"uid",
"gid"
- ]).forEach((key): void => {
- const arr = trim(header[key]);
- if (arr.byteLength > 0) {
- meta[key] = parseInt(decoder.decode(arr), 8);
+ ]).forEach(
+ (key): void => {
+ const arr = trim(header[key]);
+ if (arr.byteLength > 0) {
+ meta[key] = parseInt(decoder.decode(arr), 8);
+ }
}
- });
- (["owner", "group"] as ["owner", "group"]).forEach((key): void => {
- const arr = trim(header[key]);
- if (arr.byteLength > 0) {
- meta[key] = decoder.decode(arr);
+ );
+ (["owner", "group"] as ["owner", "group"]).forEach(
+ (key): void => {
+ const arr = trim(header[key]);
+ if (arr.byteLength > 0) {
+ meta[key] = decoder.decode(arr);
+ }
}
- });
+ );
// read the file content
const len = parseInt(decoder.decode(header.fileSize), 8);