Demo for query storing

Change-Id: I947bcac841992c3f6cfd01ab337c265b0d01cb70
diff --git a/node_modules/jpegtran-bin/lib/index.js b/node_modules/jpegtran-bin/lib/index.js
new file mode 100644
index 0000000..3d18329
--- /dev/null
+++ b/node_modules/jpegtran-bin/lib/index.js
@@ -0,0 +1,21 @@
+'use strict';
+const path = require('path');
+const BinWrapper = require('bin-wrapper');
+const pkg = require('../package.json');
+
+const url = `https://raw.githubusercontent.com/imagemin/jpegtran-bin/v${pkg.version}/vendor/`;
+
+module.exports = new BinWrapper()
+	.src(`${url}macos/jpegtran`, 'darwin')
+	.src(`${url}linux/x86/jpegtran`, 'linux', 'x86')
+	.src(`${url}linux/x64/jpegtran`, 'linux', 'x64')
+	.src(`${url}freebsd/x86/jpegtran`, 'freebsd', 'x86')
+	.src(`${url}freebsd/x64/jpegtran`, 'freebsd', 'x64')
+	.src(`${url}sunos/x86/jpegtran`, 'sunos', 'x86')
+	.src(`${url}sunos/x64/jpegtran`, 'sunos', 'x64')
+	.src(`${url}win/x86/jpegtran.exe`, 'win32', 'x86')
+	.src(`${url}win/x64/jpegtran.exe`, 'win32', 'x64')
+	.src(`${url}win/x86/libjpeg-62.dll`, 'win32', 'x86')
+	.src(`${url}win/x64/libjpeg-62.dll`, 'win32', 'x64')
+	.dest(path.join(__dirname, '../vendor'))
+	.use(process.platform === 'win32' ? 'jpegtran.exe' : 'jpegtran');
diff --git a/node_modules/jpegtran-bin/lib/install.js b/node_modules/jpegtran-bin/lib/install.js
new file mode 100644
index 0000000..7260baa
--- /dev/null
+++ b/node_modules/jpegtran-bin/lib/install.js
@@ -0,0 +1,37 @@
+'use strict';
+const path = require('path');
+const binBuild = require('bin-build');
+const log = require('logalot');
+const bin = require('.');
+
+const args = [
+	'-copy',
+	'none',
+	'-optimize',
+	'-outfile',
+	path.join(__dirname, '../test/fixtures/test-optimized.jpg'),
+	path.join(__dirname, '../test/fixtures/test.jpg')
+];
+
+bin.run(args).then(() => {
+	log.success('jpegtran pre-build test passed successfully');
+}).catch(error => {
+	log.warn(error.message);
+	log.warn('jpegtran pre-build test failed');
+	log.info('compiling from source');
+
+	const cfg = [
+		'./configure --disable-shared',
+		`--prefix="${bin.dest()}" --bindir="${bin.dest()}"`
+	].join(' ');
+
+	binBuild.url('https://downloads.sourceforge.net/project/libjpeg-turbo/1.5.1/libjpeg-turbo-1.5.1.tar.gz', [
+		'touch configure.ac aclocal.m4 configure Makefile.am Makefile.in',
+		cfg,
+		'make install'
+	]).then(() => {
+		log.success('jpegtran built successfully');
+	}).catch(error => {
+		log.error(error.stack);
+	});
+});