diff --git a/client/camera/README.md b/client/camera/README.md index 12eb728..ad408ba 100644 --- a/client/camera/README.md +++ b/client/camera/README.md @@ -1,3 +1,18 @@ -# RainCatcher Camera Plugin +# RainCatcher Cordova Camera Wrapper -Simple wrapper around the [Cordova Camera Plugin](https://github.com/apache/cordova-plugin-camera) that uses the File Store client. +Wrapper around the [Cordova Camera Plugin](https://github.com/apache/cordova-plugin-camera) that uses the File Store client. + +## Example + +```typescript +import { Camera } from '@raincatcher/camera'); +const camera = new Camera(); +camera.capture().then(function(captureResponse) { + const file = { + uri: captureResponse.value, + type: captureResponse.type, + }; + // Uri can be used to display file + return file; +} +``` diff --git a/client/filestore-client/README.md b/client/filestore-client/README.md index 90bbf09..11206cb 100644 --- a/client/filestore-client/README.md +++ b/client/filestore-client/README.md @@ -1,10 +1,11 @@ # RainCatcher FileStore client RainCatcher FileStore Client provides a manager which provides the support for: + - Downloading files from a server. - Uploading files from a mobile device to a server. -## Usage +## Usage 1. Implement the [HttpClient](./src/HttpClient.ts) Interface 2. Import FileManager @@ -22,4 +23,5 @@ fileManager.scheduleFileToBeDownloaded(fileQueueEntry); - Ensure the fileQueueEntry adheres to the [FileQueueEntry](./src/FileQueueEntry.ts) interface. ## HttpClient Interface + The [HttpClient](./src/HttpClient.ts) interface should be implemented in order to enable the FileStore client to make network requests for uploading and downloading files to and from a server. diff --git a/cloud/datasync/example/index.ts b/cloud/datasync/example/index.ts index 4918194..7726dda 100644 --- a/cloud/datasync/example/index.ts +++ b/cloud/datasync/example/index.ts @@ -1,7 +1,9 @@ -import { getLogger } from '@raincatcher/logger'; +import { BunyanLogger, getLogger, setLogger} from '@raincatcher/logger'; import SyncServer, { SyncApi, SyncExpressMiddleware, SyncOptions } from '../src/index'; +setLogger(new BunyanLogger({name: 'Sync example', level: 'debug'})); const logger = getLogger(); + const sync: SyncApi = SyncServer; // Connect sync diff --git a/cloud/filestore/README.md b/cloud/filestore/README.md index 7b68f99..ab90df2 100644 --- a/cloud/filestore/README.md +++ b/cloud/filestore/README.md @@ -19,4 +19,12 @@ expressApp.use('/file', createRouter(storage)); The `FileStorage` is an interface that should be implemented in order to supply an alternative place for file data to be transferred to, based on manipulating [NodeJS Streams](https://nodejs.org/api/stream.html) to allow storage and retrieval of the uploaded binary data. -The [current implementations](./src/impl/) support GridFS (MongoDB's API for storing larger files) and Amazon S3 buckets. \ No newline at end of file +## Implementations + +The [current implementations](./src/impl/) support: + +- GridFS (MongoDB's API for storing larger files - GridFsStorage) +- Amazon S3 (S3Storage) +- Local file storage (LocalStorage) + +See individual storage implementations for the list of required parameters. diff --git a/cloud/filestore/example/README.md b/cloud/filestore/example/README.md index 114997e..108401a 100644 --- a/cloud/filestore/example/README.md +++ b/cloud/filestore/example/README.md @@ -1,16 +1,13 @@ ## File store server -File +File store server example use case. +Example using local file storage. +See documentation for complete list of the storage implementations available. ## Running ts-node ./example/index.ts -## Requirements - -`MONGO_CONNECTION_URL` environment variable that points to a mongodb instance. -By default using: mongodb://127.0.0.1:27017/sync - -`REDIS_HOST` and `REDIS_PORT` environment variables that points to a running redis instance. -By default using: 127.0.0.1 and 6379 +## Testing +Use filestore-client to test running api. diff --git a/cloud/filestore/example/index.ts b/cloud/filestore/example/index.ts index f98e7f0..cd6c072 100644 --- a/cloud/filestore/example/index.ts +++ b/cloud/filestore/example/index.ts @@ -1,14 +1,13 @@ -import { getLogger } from '@raincatcher/logger'; +import { BunyanLogger, getLogger, setLogger} from '@raincatcher/logger'; import { createRouter, FileMetadata, FileStorage, LocalStorage } from '../src/index'; -const logger = getLogger(); - // Create express middleware import * as bodyParser from 'body-parser'; import * as cors from 'cors'; import * as express from 'express'; const app = express(); +setLogger(new BunyanLogger({name: 'Filestore example', level: 'debug'})); // middleware app.use(bodyParser.json()); @@ -18,9 +17,8 @@ const engine: FileStorage = new LocalStorage(); const router = createRouter(engine); app.use('/', router); - app.listen(3000, function() { - logger.info('Example app listening on port 3000!'); + getLogger().info('Example app listening on port 3000!'); }); // If you wish to see logs; process.env.DEBUG = 'fh-mbaas-api:sync'; diff --git a/cloud/filestore/src/file-api/FileMetadata.ts b/cloud/filestore/src/file-api/FileMetadata.ts index cfa691a..d8756b2 100644 --- a/cloud/filestore/src/file-api/FileMetadata.ts +++ b/cloud/filestore/src/file-api/FileMetadata.ts @@ -1,4 +1,3 @@ - /** * Interface contains documented fields that can be used by implementation to save and query files. * Actual implementation can use any other fields that are required to be saved along with the file. diff --git a/cloud/filestore/src/file-api/FileStorage.ts b/cloud/filestore/src/file-api/FileStorage.ts index 45201ca..deff09c 100644 --- a/cloud/filestore/src/file-api/FileStorage.ts +++ b/cloud/filestore/src/file-api/FileStorage.ts @@ -1,3 +1,4 @@ +import * as Promise from 'bluebird'; import { Stream } from 'stream'; import { FileMetadata } from './FileMetadata';