This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pkgcloud = require('pkgcloud'); | |
const streamifier = require('streamifier'); | |
module.exports = { | |
init(providerOptions) { | |
const client = pkgcloud.storage.createClient(providerOptions); | |
const options = { container: providerOptions.defaultContainerName } | |
const remoteURL = () => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as stream from 'stream'; | |
import { promisify } from 'util'; | |
const finished = promisify(stream.finished); | |
export async function downloadFile(fileUrl: string, outputLocationPath: string): Promise<any> { | |
const writer = createWriteStream(outputLocationPath); | |
return Axios({ | |
method: 'get', | |
url: fileUrl, | |
responseType: 'stream', | |
}).then(async response => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export async function downloadFile(fileUrl: string, outputLocationPath: string) { | |
const writer = createWriteStream(outputLocationPath); | |
| |
return Axios({ | |
method: 'get', | |
url: fileUrl, | |
responseType: 'stream', | |
}).then(response => { | |
//ensure that the user can call `then()` only when the file has | |
//been downloaded entirely. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Opens a file at a specified URL and returns a Flowable ready to emit | |
* its contents line by line. | |
* | |
* @param filepath the file path to open | |
* @return a stream ready to be consumed. Its output will be a file line on each emission. | |
*/ | |
public Flowable<String> openFileAsStream(String filepath) { | |
return Flowable.using( | |
() -> new BufferedReader(new FileReader(filepath)), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type PromiseThunk = (lineBatch: string[]) => Promise<any>; | |
/** | |
* | |
* @param filePath the file to open | |
* @param promiseThunk A function that returns a promise. This function will be called with the current batch lines as the arcument. | |
* @param bufferSize how many lines should we process at a time | |
*/ | |
export async function streamFile2(filePath: string, promiseThunk: PromiseThunk, bufferSize: number = 100) { | |
return new Promise<unknown>((resolve, reject) => { | |
//create the NodeJS read stream |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyApp extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
// This defines the initial navigation state. | |
navigationState: { | |
index: 0, // starts with first route focused. | |
routes: [{key: 'LaunchScreen'}], // starts with only one route. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.knex = require('knex')({ | |
client: 'pg', | |
connection: { | |
host : '127.0.0.1', | |
user : 'your_database_user', | |
password : 'your_database_password', | |
database : 'myapp_test' | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initialize the application trackers | |
- (BOOL) doInitTrackers { | |
// // Initialize the image or marker tracker | |
QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance(); | |
// | |
// // Image Tracker... | |
QCAR::Tracker* trackerBase = trackerManager.initTracker(QCAR::ObjectTracker::getClassType()); | |
if (trackerBase == NULL) | |
{ |