Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
Merge d44ba99 into 5778d53
Browse files Browse the repository at this point in the history
  • Loading branch information
wtrocki committed Nov 23, 2017
2 parents 5778d53 + d44ba99 commit 22aceda
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 17 deletions.
18 changes: 16 additions & 2 deletions client/camera/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# 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();
this.camera.capture().then(function(captureResponse) {
const file = {
uri: captureResponse.value,
type: captureResponse.type,
id: captureResponse.id
};
}
```
4 changes: 3 additions & 1 deletion client/filestore-client/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
10 changes: 9 additions & 1 deletion cloud/filestore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
## 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.
12 changes: 3 additions & 9 deletions cloud/filestore/example/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
## 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

4 changes: 1 addition & 3 deletions cloud/filestore/example/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { getLogger } 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';
Expand All @@ -20,7 +18,7 @@ const router = createRouter(engine);
app.use('/', router);

app.listen(3000, function() {
logger.info('Example app listening on port 3000!');
console.info('Example app listening on port 3000!');
});
// If you wish to see logs;
process.env.DEBUG = 'fh-mbaas-api:sync';
1 change: 0 additions & 1 deletion cloud/filestore/src/file-api/FileMetadata.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 1 addition & 0 deletions cloud/filestore/src/file-api/FileStorage.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as Promise from 'bluebird';
import { Stream } from 'stream';
import { FileMetadata } from './FileMetadata';

Expand Down

0 comments on commit 22aceda

Please sign in to comment.