Skip to content

Service

constructor (app, options)

Create an instance of the service with the given options:

ParameterDescriptionRequired
s3Optionsthe options to configure the S3 service. Refer to feathers-s3 API.yes
appthe feathers app.yes
allowedServicePathsthe allowed path to the services. It must be a regular expression or an array of regular expressions.yes
workingDirthe working directory to process temporary files. Default value is /tmp.no

registerTransform (key, transform)

Register a transformation function for the given key.

ParameterDescriptionRequired
keythe key assigned to the transformation function.yes
transformthe transformation function.yes

create (data, params)

Shortcut method that calls import or export according the value of the method property.

The payload data must contain the following properties:

ArgumentDescriptionRequired
methodthe method to call, either import or export.yes

Concerning the other properties, refer to the description of the different methods.

import (data, params)

Imports the content of a file that is stored on a S3 compatible storage.

The payload data must contain the following properties:

ArgumentDescriptionRequired
idthe object key. Note that the final computed key takes into account the prefix option of the service.yes
servicePaththe service path into which the data should be imported.yes
transformthe transformation to apply before importing the data. Default is undefinedno

export (data, params)

Exports the result of a query into a JSON, CSV or GeoJson file that it stored on an S3 compatible storage. The file can be archived in zip or tgz using Archiver. By default It returns a Presigned URL to the file.

The payload data must contain the following properties:

ArgumentDescriptionRequired
servicePaththe service path to be queried..yes
querythe query to apply. Default value is {}no
chunkPaththe path to the data when processing the query response. Default value is datano
chunkSizethe number of objects to be processed by chunk. Default value is 500no
transformthe transformation to apply before exporting the data. Default is undefinedno
formatthe output format. Défaut value is jsonno
archivewhether to archive the output or not. It should be zip, tgz or undefined. Default value is undefinedno
signedUrlwhether to return a signed url. Default value is trueno
expiresInthe expiration delay of the returned signed url. Default value is 300no

WARNING

The chunkSize must be less than the max property of the paginate options assigned to the service.