ImageLayout
Class: ImageLayout
Defined in: packages/oci/src/layout.ts:30
An OCI image layout on disk: oci-layout, index.json and blobs/sha256/<hex>
It is the build output and the source of the push.
Constructors
Constructor
new ImageLayout(
path):ImageLayout
Defined in: packages/oci/src/layout.ts:34
Parameters
path
string
folder of the layout
Returns
ImageLayout
Properties
path
readonlypath:string
Defined in: packages/oci/src/layout.ts:34
folder of the layout
Methods
blobPath()
blobPath(
digest):string
Defined in: packages/oci/src/layout.ts:45
Path of a blob
Parameters
digest
string
the blob digest
Returns
string
the file path
blobSize()
blobSize(
digest):number
Defined in: packages/oci/src/layout.ts:79
Size of a blob
Parameters
digest
string
the blob digest
Returns
number
the size in bytes
blobStream()
blobStream(
digest):Readable
Defined in: packages/oci/src/layout.ts:89
Stream a blob
Parameters
digest
string
the blob digest
Returns
Readable
the stream
hasBlob()
hasBlob(
digest):boolean
Defined in: packages/oci/src/layout.ts:59
Check whether a blob is in the layout
Parameters
digest
string
the blob digest
Returns
boolean
true if present
readBlob()
readBlob(
digest):Buffer
Defined in: packages/oci/src/layout.ts:69
Read a blob
Parameters
digest
string
the blob digest
Returns
Buffer
the content
readIndex()
readIndex():
ImageIndex
Defined in: packages/oci/src/layout.ts:221
Read the index.json of the layout
Returns
the index
writeBlob()
writeBlob(
data,mediaType):Descriptor
Defined in: packages/oci/src/layout.ts:100
Write a blob from memory
Parameters
data
Buffer
the content
mediaType
string
its media type
Returns
its descriptor
writeIndex()
writeIndex(
manifests):void
Defined in: packages/oci/src/layout.ts:211
Write the index.json of the layout
Parameters
manifests
descriptors of the images or index, with their org.opencontainers.image.ref.name
Returns
void
writeJson()
writeJson(
value,mediaType):Descriptor
Defined in: packages/oci/src/layout.ts:116
Write a JSON blob
Parameters
value
any
the document
mediaType
string
its media type
Returns
its descriptor
writeLayer()
writeLayer(
entries,options?):Promise<{descriptor:Descriptor;diffId:string; }>
Defined in: packages/oci/src/layout.ts:164
Create a gzip layer from tar entries
The tar is reproducible (see generateTar) and the gzip header carries no timestamp and the unix OS code, so the same entries give the same layer digest.
Parameters
entries
TarEntry[]
sorted entries, see withDirectories
options?
TarOptions = {}
shared tar options
Returns
Promise<{ descriptor: Descriptor; diffId: string; }>
the layer descriptor and its uncompressed digest (diff id)
writeStream()
writeStream(
stream,expected?):Promise<{digest:string;size:number; }>
Defined in: packages/oci/src/layout.ts:127
Write a blob from a stream, checking its digest when one is expected
Parameters
stream
Readable | ReadableStream<any>
the content
expected?
string
the expected digest
Returns
Promise<{ digest: string; size: number; }>
the digest and size