@vltpkg/registry-client/cache-entry
Classes
CacheEntry
Defined in: cache-entry.ts:57
Constructors
new CacheEntry()
Defined in: cache-entry.ts:66
Parameters
statusCode
number
headers
Buffer
[]
integrity?
`sha512-${string}`
Returns
Accessors
body
Get Signature
Defined in: cache-entry.ts:193
Returns
Buffer
| Record
<string
, any
>
headers
Get Signature
Defined in: cache-entry.ts:137
Returns
Buffer
[]
integrity
Get Signature
Defined in: cache-entry.ts:161
Returns
undefined
| `sha512-${string}`
integrityActual
Get Signature
Defined in: cache-entry.ts:154
Returns
`sha512-${string}`
isGzip
Get Signature
Defined in: cache-entry.ts:213
Returns
boolean
isJSON
Get Signature
Defined in: cache-entry.ts:198
Returns
boolean
statusCode
Get Signature
Defined in: cache-entry.ts:134
Returns
number
valid
Get Signature
Defined in: cache-entry.ts:105
true
if the entry represents a cached response that is still
valid to use.
Returns
boolean
Methods
[kCustomInspect]()
Defined in: cache-entry.ts:86
Parameters
depth
number
options
InspectOptions
Returns
string
addBody()
Defined in: cache-entry.ts:129
Parameters
b
Buffer
Returns
void
buffer()
Defined in: cache-entry.ts:182
Return the body of the entry as a Buffer
Returns
Buffer
checkIntegrity()
Defined in: cache-entry.ts:150
check that the sri integrity string that was provided to the ctor matches the body that we actually received. This should only be called AFTER the entire body has been completely downloaded.
Note that this will usually not be true if the value is coming out of the cache, because the cache entries are un-gzipped in place. It should only be called for artifacts that come from an actual http response.
Returns
boolean
encode()
Defined in: cache-entry.ts:315
Encode the entry as a single Buffer for writing to the cache
Returns
Buffer
getHeader()
Defined in: cache-entry.ts:168
Give it a key, and it’ll return the buffer of that header value
Parameters
h
string
Returns
undefined
| Buffer
json()
Defined in: cache-entry.ts:265
Parse the entry body as JSON and return the result
Returns
setHeader()
Defined in: cache-entry.ts:175
Set a header to a specific value
Parameters
h
string
value
string
| Buffer
Returns
void
text()
Defined in: cache-entry.ts:257
Return the body of the entry as utf8 text Automatically unzips if the content is gzip encoded
Returns
string
unzip()
Defined in: cache-entry.ts:234
Un-gzip encode the body. Returns true if it was previously gzip (so something was done), otherwise returns false.
Returns
boolean
decode()
Defined in: cache-entry.ts:277
Pass the contents of a @vltpkg/cache.Cache object as a buffer, and this static method will decode it into a CacheEntry representing the cached response.
Parameters
buffer
Buffer
Returns
Type Aliases
JSONObj
Defined in: cache-entry.ts:30