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

Commit

Permalink
Merge 95bd9f3 into 5778d53
Browse files Browse the repository at this point in the history
  • Loading branch information
wtrocki committed Nov 23, 2017
2 parents 5778d53 + 95bd9f3 commit 546981b
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 19 deletions.
19 changes: 17 additions & 2 deletions client/camera/README.md
Original file line number Diff line number Diff line change
@@ -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;
}
```
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.
4 changes: 3 additions & 1 deletion cloud/datasync/example/index.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
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.
13 changes: 5 additions & 8 deletions cloud/filestore/example/README.md
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 3 additions & 5 deletions cloud/filestore/example/index.ts
Original file line number Diff line number Diff line change
@@ -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());
Expand All @@ -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';
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 546981b

Please sign in to comment.