content-entry
Version:
content entries for content containers (aka files)
91 lines (82 loc) • 10.7 kB
Markdown
[](https://www.npmjs.com/package/content-entry)
[](https://spdx.org/licenses/0BSD.html)
[](https://typescriptlang.org)
[](https://bundlejs.com/?q=content-entry)
[](https://npmjs.org/package/content-entry)
[](https://github.com/arlac77/content-entry/issues)
[](https://actions-badge.atrox.dev/arlac77/content-entry/goto)
[](https://github.com/prettier/prettier)
[](http://commitizen.github.io/cz-cli/)
[](https://snyk.io/test/github/arlac77/content-entry)
[](https://coveralls.io/github/arlac77/content-entry)
## content-entrycontent entries for content containers (aka files)
# API<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
### Table of Contents* [CollectionEntryMixin](#collectionentrymixin)
* [Parameters](#parameters)
* [BaseEntry](#baseentry)
* [Parameters](#parameters-1)
* [Properties](#properties)
* [types](#types)
* [isCollection](#iscollection)
* [isBlob](#isblob)
* [mode](#mode)
* [isEmpty](#isempty)
* [isDeleted](#isdeleted)
* [isExistent](#isexistent)
* [equals](#equals)
* [Parameters](#parameters-2)
* [BufferContentEntryMixin](#buffercontententrymixin)
* [Parameters](#parameters-3)
* [Properties](#properties-1)
* [BufferContentEntry](#buffercontententry)
* [Parameters](#parameters-4)
* [isEmpty](#isempty-1)
* [size](#size)
* [ContentEntry](#contententry)
* [isBlob](#isblob-1)
* [types](#types-1)
* [readStream](#readstream)
* [string](#string)
* [buffer](#buffer)
* [encoding](#encoding)
* [equalsContent](#equalscontent)
* [Parameters](#parameters-5)
* [getReadStream](#getreadstream)
* [DeletedContentEntry](#deletedcontententry)
* [isDeleted](#isdeleted-1)
* [isExistent](#isexistent-1)
* [EmptyContentEntry](#emptycontententry)
* [string](#string-1)
* [buffer](#buffer-1)
* [readStream](#readstream-1)
* [toReadableStream](#toreadablestream)
* [Parameters](#parameters-6)
* [ReadableStreamContentEntry](#readablestreamcontententry)
* [Parameters](#parameters-7)
* [Properties](#properties-2)
* [StreamContentEntryMixin](#streamcontententrymixin)
* [Parameters](#parameters-8)
* [StringContentEntryMixin](#stringcontententrymixin)
* [Parameters](#parameters-9)
* [Properties](#properties-3)
* [StringContentEntry](#stringcontententry)
* [Parameters](#parameters-10)
* [Properties](#properties-4)
* [isEmpty](#isempty-2)
* [equalsUint8Arrays](#equalsuint8arrays)
* [Parameters](#parameters-11)## CollectionEntryMixinBrings directory attributes to entries.### Parameters* `superclass`  ## BaseEntryRepresentation of one file or directory entry.
All names are absolute (no leading '/') the group seperator is '/'.### Parameters* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name inside of the container### Properties* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name inside of the container### typesReturns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** UTI types### isCollectionReturns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** false### isBlobReturns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** false### modeDefault unix mode for files.Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** 0644### isEmptyReturns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if there is no content (length := 0).### isDeletedReturns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if we represent a deleted entry### isExistentReturns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if we exist### equals#### Parameters* `other`  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** true if name, isBlob and isCollection are the same## BufferContentEntryMixinContent entries where a Uint8Array is the primary data representation.### Parameters* `superclass`  ### Properties* `buffer` **[Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)** ## BufferContentEntry**Extends BufferContentEntryMixin(ContentEntry)**ConentEntry with a Uint8Array as content store.### Parameters* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
* `buffer` **[Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)** ### isEmptyReturns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if buffer length is zero### sizeReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** size in bytes## ContentEntry**Extends BaseEntry**General content access entries.### isBlobReturns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true### typesUTI types for this entry.
defaults to "public.content".Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** ### readStreamReturns **any** undefined### stringReturns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ### bufferreturn {Uint8Array}### encodingThe default encoding used to convert content to strings.Returns **BufferEncoding** ### equalsContentCompare content against other entry.#### Parameters* `other` **[ContentEntry](#contententry)** Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** true if other has the same content (bitwise)### getReadStream**Meta*** **deprecated**: This is deprecated.## DeletedContentEntry**Extends EmptyContentEntry**Represents a deleted entry.### isDeletedWe are always deleted.Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true### isExistentNothing there any more.Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** false## EmptyContentEntry**Extends ContentEntry**Represents a entry without content (content length = 0).### stringReturns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ### bufferReturns **[Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)** zero length buffer### readStreamReturns **ReadableStream** zero length stream.## toReadableStream### Parameters* `input` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Returns **Readable** ## ReadableStreamContentEntry**Extends StreamContentEntryMixin(ContentEntry)**Content entries where a readable stream is the primary data representation.### Parameters* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
* `readStream` **ReadableStream** ### Properties* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
* `readStream` **ReadableStream** ## StreamContentEntryMixinContent entries where a stream is the primary data representation.### Parameters* `superclass`  ## StringContentEntryMixinContent entries where a string is the primary data representation.### Parameters* `superclass`  ### Properties* `string` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ## StringContentEntry**Extends StringContentEntryMixin(ContentEntry)**Content entries where a string is the primary data representation.### Parameters* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
* `value` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ### Properties* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
* `string` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ### isEmptyReturns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if string length is zero## equalsUint8ArraysReturns true if the two passed Uint8Arrays have the same content### Parameters* `a` **[Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)** 
* `b` **[Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)** Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if content of a equals b
# install
With [npm](http://npmjs.org) do:
```shell
npm install content-entry
```
# license
BSD-2-Clause