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, 29 insertions, 35 deletions
diff --git a/std/archive/tar.ts b/std/archive/tar.ts
index f33ea69a4..8ebfa7fb5 100644
--- a/std/archive/tar.ts
+++ b/std/archive/tar.ts
@@ -384,28 +384,26 @@ 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)));
@@ -462,22 +460,18 @@ 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);