UNPKG

content-entry

Version:

content entries for content containers (aka files)

91 lines (82 loc) 10.7 kB
[![npm](https://img.shields.io/npm/v/content-entry.svg)](https://www.npmjs.com/package/content-entry) [![License](https://img.shields.io/badge/License-0BSD-blue.svg)](https://spdx.org/licenses/0BSD.html) [![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript\&label\&labelColor=blue\&color=555555)](https://typescriptlang.org) [![bundlejs](https://deno.bundlejs.com/?q=content-entry\&badge=detailed)](https://bundlejs.com/?q=content-entry) [![downloads](http://img.shields.io/npm/dm/content-entry.svg?style=flat-square)](https://npmjs.org/package/content-entry) [![GitHub Issues](https://img.shields.io/github/issues/arlac77/content-entry.svg?style=flat-square)](https://github.com/arlac77/content-entry/issues) [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Farlac77%2Fcontent-entry%2Fbadge\&style=flat)](https://actions-badge.atrox.dev/arlac77/content-entry/goto) [![Styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) [![Known Vulnerabilities](https://snyk.io/test/github/arlac77/content-entry/badge.svg)](https://snyk.io/test/github/arlac77/content-entry) [![Coverage Status](https://coveralls.io/repos/arlac77/content-entry/badge.svg)](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` &#x20;## 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` &#x20;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` &#x20;### Properties* `buffer` **[Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)**&#x20;## 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)**&#x20; * `buffer` **[Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)**&#x20;### 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)**&#x20;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)**&#x20;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)**&#x20; * `readStream` **ReadableStream**&#x20;### Properties* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20; * `readStream` **ReadableStream**&#x20;## StreamContentEntryMixinContent entries where a stream is the primary data representation.### Parameters* `superclass` &#x20;## StringContentEntryMixinContent entries where a string is the primary data representation.### Parameters* `superclass` &#x20;### Properties* `string` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;## 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)**&#x20; * `value` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;### Properties* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20; * `string` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;### 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)**&#x20; * `b` **[Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)**&#x20;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