Class: S3Binary<T>
S3Binary handles the storage of binary on a S3 bucket
The structure used for now is /{hash}/data /{hash}/{targetStore}_{uuid} The challenge is stored on the metadata of the data object
It takes parameters bucket: "bucketName" accessKeyId: "" secretAccessKey: "" region: ""
See Binary the general interface
We can register on S3 Event to get info when /data is pushed
Webda Modda
Extends
CloudBinary
<T
>
Type parameters
• T extends S3BinaryParameters
= S3BinaryParameters
Implements
Constructors
new S3Binary(webda, name, params)
new S3Binary<
T
>(webda
,name
,params
?):S3Binary
<T
>
Parameters
• webda: Core
<CoreEvents
>
The main instance of Webda
• name: string
The name of the service
• params?: DeepPartial
<T
>
The parameters block define in the configuration file
Returns
S3Binary
<T
>
Inherited from
CloudBinary<T>.constructor
Source
packages/core/lib/services/service.d.ts:168
Properties
_createException
_createException:
string
Inherited from
CloudBinary._createException
Source
packages/core/lib/services/service.d.ts:149
_initException
_initException:
any
Inherited from
CloudBinary._initException
Source
packages/core/lib/services/service.d.ts:151
_initTime
_initTime:
number
Inherited from
CloudBinary._initTime
Source
packages/core/lib/services/service.d.ts:150
_lowercaseMaps
_lowercaseMaps:
any
Inherited from
CloudBinary._lowercaseMaps
Source
packages/core/lib/services/binary.d.ts:370
_name
protected
_name:string
Service name
Inherited from
CloudBinary._name
Source
packages/core/lib/services/service.d.ts:142
_s3
_s3:
S3
Source
packages/aws/src/services/s3binary.ts:61
_webda
protected
_webda:Core
<CoreEvents
>
Webda Core object
Inherited from
CloudBinary._webda
Source
packages/core/lib/services/service.d.ts:138
logger
protected
logger:Logger
Logger with class context
Inherited from
CloudBinary.logger
Source
packages/core/lib/services/service.d.ts:155
metrics
metrics:
Object
Type declaration
delete
delete:
Counter
<string
>
download
download:
Counter
<string
>
metadataUpdate
metadataUpdate:
Counter
<string
>
upload
upload:
Counter
<string
>
Inherited from
CloudBinary.metrics
Source
packages/core/lib/services/binary.d.ts:371
parameters
protected
parameters:T
Hold the parameters for your service
It will be bring from the webda.config.json
Inherited from
CloudBinary.parameters
Source
packages/core/lib/services/service.d.ts:148
captureRejectionSymbol
static
readonly
captureRejectionSymbol: typeofcaptureRejectionSymbol
Inherited from
CloudBinary.captureRejectionSymbol
Source
node_modules/@types/node/events.d.ts:38
captureRejections
static
captureRejections:boolean
Sets or gets the default captureRejection value for all emitters.
Inherited from
CloudBinary.captureRejections
Source
node_modules/@types/node/events.d.ts:44
defaultMaxListeners
static
defaultMaxListeners:number
Inherited from
CloudBinary.defaultMaxListeners
Source
node_modules/@types/node/events.d.ts:45
errorMonitor
static
readonly
errorMonitor: typeoferrorMonitor
This symbol shall be used to install a listener for only monitoring 'error'
events. Listeners installed using this symbol are called before the regular
'error'
listeners are called.
Installing a listener using this symbol does not change the behavior once an
'error'
event is emitted, therefore the process will still crash if no
regular 'error'
listener is installed.
Inherited from
CloudBinary.errorMonitor
Source
node_modules/@types/node/events.d.ts:37
Methods
__clean()
__clean():
Promise
<void
>
Clean the service data, can only be used in test mode
Returns
Promise
<void
>
Inherited from
CloudBinary.__clean
Abstract
Source
packages/core/lib/services/service.d.ts:319
_cleanHash()
_cleanHash(
hash
):Promise
<void
>
Parameters
• hash: string
Returns
Promise
<void
>
Inherit Doc
Source
packages/aws/src/services/s3binary.ts:237
_cleanUsage()
_cleanUsage(
hash
,uuid
,attribute
?):Promise
<void
>
Parameters
• hash: string
• uuid: string
• attribute?: string
Returns
Promise
<void
>
Overrides
CloudBinary._cleanUsage
Inherit Doc
Source
packages/aws/src/services/s3binary.ts:260
_exists()
_exists(
hash
):Promise
<boolean
>
Parameters
• hash: string
Returns
Promise
<boolean
>
Inherit Doc
Source
packages/aws/src/services/s3binary.ts:275
_get()
_get(
info
):Promise
<Readable
>
Parameters
• info: BinaryMap
<any
>
Returns
Promise
<Readable
>
Overrides
CloudBinary._get
Source
packages/aws/src/services/s3binary.ts:193
_getFile()
_getFile(
req
):Promise
<BinaryFile
<any
>>
Get file either from multipart post or raw
Parameters
• req: WebContext
<any
, any
>
Returns
Promise
<BinaryFile
<any
>>
Inherited from
CloudBinary._getFile
Source
packages/core/lib/services/binary.d.ts:508
_getKey()
_getKey(
hash
,suffix
?):string
Return the S3 key
Parameters
• hash: string
• suffix?: string
Returns
string
Inherited from
CloudBinary._getKey
Source
packages/core/lib/services/cloudbinary.d.ts:29
_getS3()
_getS3(
hash
):Promise
<HeadObjectCommandOutput
>
Get a head object
Parameters
• hash: string
Returns
Promise
<HeadObjectCommandOutput
>
Source
packages/aws/src/services/s3binary.ts:295
_initRoutes()
_initRoutes():
void
Init the Binary system routes
Making sure parameters.expose exists prior
Returns
void
Inherited from
CloudBinary._initRoutes
Source
packages/core/lib/services/binary.d.ts:518
_verifyMapAndStore()
_verifyMapAndStore(
ctx
):Store
<CoreModel
,StoreParameters
,StoreEvents
>
Based on the request parameter verify it match a known mapping
Parameters
• ctx: WebContext
<any
, any
>
Returns
Store
<CoreModel
, StoreParameters
, StoreEvents
>
Inherited from
CloudBinary._verifyMapAndStore
Source
packages/core/lib/services/binary.d.ts:529
addListener()
addListener(
event
,listener
):this
Parameters
• event: string
| symbol
• listener: (...args
) => void
Returns
this
Inherited from
CloudBinary.addListener
Source
node_modules/@types/node/events.d.ts:57
addRoute()
protected
addRoute(url
,methods
,executer
,openapi
?,override
?):void
Add a route dynamicaly
Parameters
• url: string
of the route can contains dynamic part like {uuid}
• methods: HttpMethodType
[]
• executer: Function
Method to execute for this route
• openapi?: OpenAPIWebdaDefinition
• override?: boolean
Returns
void
Inherited from
CloudBinary.addRoute
Source
packages/core/lib/services/service.d.ts:242
authorizeClientEvent()
authorizeClientEvent(
_event
,_context
):boolean
Authorize a public event subscription
Parameters
• _event: string
• _context: OperationContext
<any
, any
>
Returns
boolean
Inherited from
CloudBinary.authorizeClientEvent
Source
packages/core/lib/services/service.d.ts:220
cascadeDelete()
cascadeDelete(
info
,uuid
):Promise
<void
>
Parameters
• info: BinaryMap
<any
>
• uuid: string
Returns
Promise
<void
>
Inherited from
CloudBinary.cascadeDelete
Inherit Doc
Source
packages/core/lib/services/cloudbinary.d.ts:37
checkMap()
protected
checkMap(object
,property
):void
Check if a map is defined