mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
BREAKING(archive): remove TarEntry.#header
(#5638)
This commit is contained in:
parent
f7e3cd588b
commit
d32deb73dd
@ -90,7 +90,6 @@ export interface TarEntry extends TarMetaWithLinkName {}
|
||||
|
||||
/** Contains tar header metadata and a reader to the entry's body. */
|
||||
export class TarEntry implements Reader {
|
||||
#header: TarHeader;
|
||||
#reader: Reader | (Reader & Deno.Seeker);
|
||||
#size: number;
|
||||
#read = 0;
|
||||
@ -100,11 +99,9 @@ export class TarEntry implements Reader {
|
||||
/** Constructs a new instance. */
|
||||
constructor(
|
||||
meta: TarMetaWithLinkName,
|
||||
header: TarHeader,
|
||||
reader: Reader | (Reader & Deno.Seeker),
|
||||
) {
|
||||
Object.assign(this, meta);
|
||||
this.#header = header;
|
||||
this.#reader = reader;
|
||||
|
||||
// File Size
|
||||
@ -327,7 +324,7 @@ export class Untar {
|
||||
|
||||
const meta = this.#getMetadata(header);
|
||||
|
||||
this.#entry = new TarEntry(meta, header, this.reader);
|
||||
this.#entry = new TarEntry(meta, this.reader);
|
||||
|
||||
return this.#entry;
|
||||
}
|
||||
|
@ -2,12 +2,7 @@
|
||||
import { assert, assertEquals, assertExists } from "@std/assert";
|
||||
import { resolve } from "@std/path";
|
||||
import { Tar, type TarMeta } from "./tar.ts";
|
||||
import {
|
||||
TarEntry,
|
||||
type TarHeader,
|
||||
type TarMetaWithLinkName,
|
||||
Untar,
|
||||
} from "./untar.ts";
|
||||
import { TarEntry, type TarMetaWithLinkName, Untar } from "./untar.ts";
|
||||
import { Buffer } from "@std/io/buffer";
|
||||
import { copy } from "@std/io/copy";
|
||||
import { readAll } from "@std/io/read-all";
|
||||
@ -323,26 +318,6 @@ Deno.test({
|
||||
fn() {
|
||||
// test TarEntry class
|
||||
assertExists(TarEntry);
|
||||
// Test TarEntry type
|
||||
const bufSizes = [1, 53, 256, 511];
|
||||
const header: TarHeader = {
|
||||
fileName: new Uint8Array(bufSizes),
|
||||
fileMode: new Uint8Array(bufSizes),
|
||||
uid: new Uint8Array(bufSizes),
|
||||
gid: new Uint8Array(bufSizes),
|
||||
fileSize: new Uint8Array(bufSizes),
|
||||
mtime: new Uint8Array(bufSizes),
|
||||
checksum: new Uint8Array(bufSizes),
|
||||
type: new Uint8Array(bufSizes),
|
||||
linkName: new Uint8Array(bufSizes),
|
||||
ustar: new Uint8Array(bufSizes),
|
||||
owner: new Uint8Array(bufSizes),
|
||||
group: new Uint8Array(bufSizes),
|
||||
majorNumber: new Uint8Array(bufSizes),
|
||||
minorNumber: new Uint8Array(bufSizes),
|
||||
fileNamePrefix: new Uint8Array(bufSizes),
|
||||
padding: new Uint8Array(bufSizes),
|
||||
};
|
||||
const content = new TextEncoder().encode("hello tar world!");
|
||||
const reader = new Buffer(content);
|
||||
const tarMeta = {
|
||||
@ -356,7 +331,7 @@ Deno.test({
|
||||
group: "deno",
|
||||
type: "directory",
|
||||
};
|
||||
const tarEntry: TarEntry = new TarEntry(tarMeta, header, reader);
|
||||
const tarEntry: TarEntry = new TarEntry(tarMeta, reader);
|
||||
assertExists(tarEntry);
|
||||
},
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user