diff --git a/frontend/src/App.js b/frontend/src/App.js index 949dbc6..6670079 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -13,7 +13,8 @@ import { import { Modal, - Button + Button, + Form } from "react-bootstrap"; const REMOTE_ADDR = "http://45.33.13.215:4502"; @@ -957,8 +958,8 @@ function Rankings(){ - {users.map((user)=> - + {users.map((user,i)=> + {user.username} {user.last_played} @@ -1218,10 +1219,294 @@ function RecentPlays(p) { ) } +function LoginInfo(p) { + const [username,setUsername] = useState(undefined) + const [authToken,setAuthToken] = useState(undefined) + const [loggedIn,setLoggedIn] = useState(false) + //Load our storage data if exists. + useEffect(()=>{ + try { + setUsername(localStorage.getItem("username")) + setAuthToken(localStorage.getItem("authToken")) + }catch{ + console.log("Not logged in!"); + } + },[p.update]) + + useEffect(()=>{ + if (username!==undefined&&authToken!==undefined) { + axios.post("http://projectdivar.com/authenticate/login",{username:username,authCode:authToken}) + .then((data)=>{ + setLoggedIn(true); + p.setUsername(username); + }) + .catch((err)=>{ + setLoggedIn(false); + }) + } + },[username,authToken]) + + return ( + <> + {loggedIn?<> + Welcome, {username}!
+ App Auth Code
+ + :<> + Login
+ Register + } + + ) +} + +function Login(p) { + const [username,setUsername] = useState("") + const [authCode,setAuthCode] = useState("") + const [authCodeVisible,setAuthCodeVisible] = useState(false) + const [error,setError] = useState(false) + const [disabled,setDisabled] = useState(false) + + let history = useHistory(); + + if (p.isLoggedIn) { + history.push("/") + } + + return ( + <> +
+ {error&&

{error}

} + {authCodeVisible&&<>

We have sent you an email containing your login code!

+
+ Please submit it to finish the login process. + } + + Username + {setUsername(e.currentTarget.value)}} placeholder="MikuMiku" value={username} /> + + We will send an email to the registered email of this account. + + + {authCodeVisible&&<> +
+
+ + Authentication Code + {setAuthCode(e.currentTarget.value)}} placeholder="XXXXX" value={authCode} /> + + Please enter the code you received in your email here. Then submit again. + + +
+
+ } + +
+ + ) +} + +function Register(p) { + const [username,setUsername] = useState("") + const [email,setEmail] = useState("") + const [authCode,setAuthCode] = useState("") + const [authCodeVisible,setAuthCodeVisible] = useState(false) + const [error,setError] = useState(false) + const [disabled,setDisabled] = useState(false) + let history = useHistory(); + + if (p.isLoggedIn) { + history.push("/") + } + + return ( + <> +
+ {error&&

{error}

} + {authCodeVisible&&<>

We have sent you an email containing your registration code!

+
+ Please submit it to finish the registration process. + } + + Username + {setUsername(e.currentTarget.value)}} placeholder="MikuMiku" value={username} /> + + + Email Address + {setEmail(e.currentTarget.value)}} placeholder="MikuMiku@39.net" value={email} /> + + Please provide a valid email address! We use your email account as your "password", so it is a requirement for this site. + + + {authCodeVisible&&<> +
+
+ + Authentication Code + {setAuthCode(e.currentTarget.value)}} placeholder="XXXXX" value={authCode} /> + + Please enter the code you received in your email here. Then submit again. + + +
+
+ } + +
+ + ) +} + +function UserAuth(p) { + const[showAuthCode,setShowAuthCode] = useState(false) + const[authToken,setAuthToken] = useState("") + let history = useHistory(); + + if (!p.isLoggedIn) { + history.push("/") + } + + return(<> + Your App Authentication Code is used for verifying your identity when using apps such as DivaBot. By clicking the {""} button, you understand that you should not share this code or show it to anyone! +

+ {showAuthCode? + + : + } + ) +} + +function ReleaseList(p) { + return( + <> + + + ) +} + +function DivaBot() { + const releases=[ + ["01B","http://projectdivar.com/files/releases/DivaBot01B.zip","13 Sep 2020"], + ["01A","http://projectdivar.com/files/releases/DivaBot01A.zip","13 Sep 2020"], + ["01","http://projectdivar.com/files/releases/DivaBot01.zip","13 Sep 2020"]] + + return ( + <> + DivaBot was created by sigonasr2 in order to allow Project Diva streamers to personalize their stream setups with their personal scores and achievements into their game. + +

+ The app works by monitoring your game's capture area as you are streaming in order to identify what song you are playing, and what scores you achieve. It is used with this website to make score + submitting and tracking easier. +
+ The app currently supports Megamix. Other games will be supported in the future. +
+

Setup Instructions

+ {} +
+

Downloads

+ + + ) +} + function Website() { const [songs,setSongs] = useState([]) const [update,setUpdate] = useState(false) const [tooltip,setTooltip] = useState("") + const [loginPanelUpdate,setLoginPanelUpdate] = useState(false) + const [username,setUsername] = useState(undefined) useEffect(()=>{ axios.get("http://www.projectdivar.com/songs") @@ -1233,11 +1518,11 @@ function Website() { return (
-

Sidebar Contents

+

Menu

+ +

Rankings
- Item 2
- Item 3
- Item 4
+ DivaBot
@@ -1252,13 +1537,26 @@ function Website() { - - + +

DivaBot

+ +
+ +

App Authentication Token

+

Project DivaR

+ +

Login to Project DivaR

+ +
+ +

Register New Account

+ +

Project DivaR

Under construction! diff --git a/frontend/src/setupProxy.js b/frontend/src/setupProxy.js index 9dfd225..6c30759 100644 --- a/frontend/src/setupProxy.js +++ b/frontend/src/setupProxy.js @@ -1,6 +1,27 @@ const { createProxyMiddleware } = require('http-proxy-middleware'); module.exports = function(app) { + app.use( + "/authenticate/authToken", + createProxyMiddleware({ + target: 'http://server:4501', + changeOrigin: true, + }) + ); + app.use( + "/updateRegisteredState", + createProxyMiddleware({ + target: 'http://server:4501', + changeOrigin: true, + }) + ); + app.use( + "/authenticate/login", + createProxyMiddleware({ + target: 'http://server:4501', + changeOrigin: true, + }) + ); app.use( "/authenticateuser", createProxyMiddleware({ @@ -106,13 +127,6 @@ module.exports = function(app) { changeOrigin: true, }) ); - app.use( - "/register", - createProxyMiddleware({ - target: 'http://server:4501', - changeOrigin: true, - }) - ); app.use( "/remove", createProxyMiddleware({ diff --git a/server/app.js b/server/app.js index 656eea8..73d3c2b 100644 --- a/server/app.js +++ b/server/app.js @@ -16,6 +16,7 @@ const nodemailer = require('nodemailer'); const fileUpload = require('express-fileupload'); const unzipper = require('unzipper'); const fs = require('fs'); +const moment = require('moment'); app.use( fileUpload({createParentPath:true, limits: { fileSize: 15 * 1024 * 1024, files: 1 }, @@ -81,7 +82,7 @@ app.get('/songs', (req, res) => { }) }) -app.post('/register', (req, res) => { +/*app.post('/register', (req, res) => { if (req.body && req.body.username && req.body.username.length>2 && req.body.email) { var duplicateFound=false; @@ -98,7 +99,7 @@ req.body.username.length>2 && req.body.email) { } else { res.status(400).json("Invalid username!") } -}) +})*/ app.delete('/remove',(req,res)=>{ if (req.body && @@ -281,6 +282,9 @@ CalculateSongScore=(song)=>{ console.log("Is PFC? "+(song.fine===0&&song.safe===0&&song.sad===0&&song.worst===0))*/ var scoreMult=1; var percentMult=1; + if (song.percent>110) { + song.percent=100 + } if (song.fine===0&&song.safe===0&&song.sad===0&&song.worst===0){scoreMult=2.4}else if(comboBreaks===0){scoreMult=1.4}else{scoreMult=1} switch (song.difficulty){ case "E":{if(song.percent<30){percentMult=0;}else{percentMult=1+Math.pow(1.0*((song.percent-30)/70.0),3)}}break; @@ -704,7 +708,30 @@ app.post('/song/:songname/:difficulty',(req,res)=>{ }) function CheckUserExists(username,email) { - return db.query("select id,username,email from users where username=$1 or email=$2 limit 1",[username,email]) + return db.query("select id,username,email,registered from users where username=$1 or email=$2 limit 1",[username,email]) +} + +function SendLoginEmail(username,emailTo,authCode) { + const transporter = nodemailer.createTransport({ + service: 'gmail', + auth: { + user: 'admin@projectdivar.com', + pass: process.env.GMAIL // naturally, replace both with your real credentials or an application-specific password + } + }); + transporter.sendMail({ + from: 'admin@projectdivar.com', + to: emailTo, + subject: 'Project DivaR Login Code', + html: `${username},

Thank you for using Project DivaR!

Your authentication code is ${authCode}!` + }, (err, info) => { + if (err) { + console.log(err.message) + } else { + console.log(info.envelope); + console.log(info.messageId); + } + }); } function SendRegistrationEmail(username,emailTo,authCode) { @@ -730,24 +757,127 @@ function SendRegistrationEmail(username,emailTo,authCode) { }); } +function GetUserInfo(username) { + return db.query("select id,username,email,code_time from users where username=$1 limit 1",[username]) +} +function GetUserLoginAllowed(username,authCode) { + return db.query("select id,username,email,code_time from users where username=$1 and code=$2 limit 1",[username,authCode]) +} +app.post('/authenticate/authToken',(req,res)=>{ + if (req.body&&req.body.username&&req.body.authCode) { + GetUserLoginAllowed(req.body.username.trim(),req.body.authCode.trim()) + .then((data)=>{ + if (data.rows.length>0) { + return db.query("select authentication_token from users where id=$1",[data.rows[0].id]) + } else { + return new Error("Failed login!") + } + }) + .then((data)=>{ + if (data.rows.length>0) { + res.status(200).json(data.rows[0]) + } else { + return new Error("Failed to get authentication token!") + } + }) + .catch((err)=>{ + res.status(500).json(err.message) + }) + } else { + res.status(400).json("Invalid Credentials!") + } +}) + +app.post('/authenticate/login',(req,res)=>{ + if (req.body&&req.body.username&&req.body.authCode) { + GetUserLoginAllowed(req.body.username.trim(),req.body.authCode.trim()) + .then((data)=>{ + if (data.rows.length>0) { + res.status(200).json("Login allowed!") + } else { + res.status(400).json("Failed login!") + } + }) + } else { + res.status(400).json("Invalid Credentials!") + } +}) + +app.post('/sendemail/login',function(req,res) { + if (req.body&&req.body.username) { + GetUserInfo(req.body.username.trim()) + .then((data)=>{ + if (data.rows.length>0) { + res.status(200).json("Email sent.") + //console.log(data.rows[0].code_time) + if (data.rows[0].code_time) { + if (moment(data.rows[0].code_time,"YYYY-MM-DD HH:mm:ss.SSSZ").diff(moment(),'minutes')<=-15) { + var authCode=Math.floor(Math.random()*90000)+10000 + SendLoginEmail(req.body.username,data.rows[0].email,authCode) + db.query("update users set code=$1,code_time=$3 where id=$2",[authCode,data.rows[0].id,moment()]) + } + //console.log(moment(data.rows[0].code_time,"YYYY-MM-DD HH:mm:ss.SSSZ").diff(moment(),'minutes')) + } else { + var authCode=Math.floor(Math.random()*90000)+10000 + SendLoginEmail(req.body.username,data.rows[0].email,authCode) + db.query("update users set code=$1,code_time=$3 where id=$2",[authCode,data.rows[0].id,moment()]) + } + } else { + res.status(400).json("User does not exist!") + } + }) + } else { + res.status(400).json("Invalid credentials!") + } +}) + +app.patch('/updateRegisteredState',function(req,res) { + if (req.body&&req.body.username&&req.body.authCode) { + GetUserLoginAllowed(req.body.username,req.body.authCode) + .then((data)=>{ + if (data.rows.length>0) { + return db.query("update users set registered=$1 where id=$2",[true,data.rows[0].id]) + } else { + throw new Error("Could not login!") + } + }) + .then((data)=>{ + res.status(200).json("Registered!") + }) + .catch((err)=>{ + res.status(500).json("Could not finish registration!") + }) + } else { + res.status(400).json("Invalid credentials!") + } +}) + app.post('/sendemail/register',function(req,res) { if (req.body&&req.body.username&&req.body.email) { //Generate a token for the user to login with. - CheckUserExists(req.body.username,req.body.email) + CheckUserExists(req.body.username.trim(),req.body.email.trim()) .then((data)=>{ var authCode=Math.floor(Math.random()*90000)+10000 var authenticationToken=String(Math.floor(Math.random()*90000)+10000)+"-"+String(Math.floor(Math.random()*90000)+10000)+"-"+String(Math.floor(Math.random()*90000)+10000); if (data.rows.length>0) { - db.query("update users set code=$1 where id=$2",[authCode,data.rows[0].id]) + //db.query("update users set code=$1 where id=$2",[authCode,data.rows[0].id]) + if (data.rows[0].registered) { + throw new Error("User already exists!") + } else { + return db.query("update users set code=$1 where id=$2 returning code",[authCode,data.rows[0].id]) + } } else { - db.query("insert into users(username,email,authentication_token,code) values($1,$2,$3,$4)", + return db.query("insert into users(username,email,authentication_token,code) values($1,$2,$3,$4) returning code", [req.body.username,req.body.email,authenticationToken,authCode]) } - return authCode }) - .then((authCode)=>{ - res.status(200).json("Email sent.") - SendRegistrationEmail(req.body.username,req.body.email,authCode) + .then((data)=>{ + if (data.rows.length>0) { + res.status(200).json("Email sent.") + SendRegistrationEmail(req.body.username,req.body.email,data.rows[0].code) + } else { + res.status(500).json("Something bad happened!") + } }) .catch((err)=>{ res.status(500).json(err.message) @@ -763,7 +893,7 @@ function AuthenticateUser(username,auth) { app.post('/authenticateuser',function(req,res) { if (req.body&&req.body.username&&req.body.authenticationToken) { - AuthenticateUser(req.body.username,req.body.authenticationToken) + AuthenticateUser(req.body.username.trim(),req.body.authenticationToken.trim()) .then((data)=>{ if (data.rows.length>0) { res.status(200).json("Authentication Success!") diff --git a/server/files/releases/DivaBot01.zip b/server/files/releases/DivaBot01.zip new file mode 100644 index 0000000..52f3064 Binary files /dev/null and b/server/files/releases/DivaBot01.zip differ diff --git a/server/files/releases/DivaBot01A.zip b/server/files/releases/DivaBot01A.zip new file mode 100644 index 0000000..7874b01 Binary files /dev/null and b/server/files/releases/DivaBot01A.zip differ diff --git a/server/files/releases/DivaBot01B.zip b/server/files/releases/DivaBot01B.zip new file mode 100644 index 0000000..00d82f0 Binary files /dev/null and b/server/files/releases/DivaBot01B.zip differ diff --git a/server/node_modules/arr-flatten/LICENSE b/server/node_modules/arr-flatten/LICENSE deleted file mode 100755 index 3f2eca1..0000000 --- a/server/node_modules/arr-flatten/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2017, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/server/node_modules/arr-flatten/README.md b/server/node_modules/arr-flatten/README.md deleted file mode 100755 index 7dc7a97..0000000 --- a/server/node_modules/arr-flatten/README.md +++ /dev/null @@ -1,86 +0,0 @@ -# arr-flatten [![NPM version](https://img.shields.io/npm/v/arr-flatten.svg?style=flat)](https://www.npmjs.com/package/arr-flatten) [![NPM monthly downloads](https://img.shields.io/npm/dm/arr-flatten.svg?style=flat)](https://npmjs.org/package/arr-flatten) [![NPM total downloads](https://img.shields.io/npm/dt/arr-flatten.svg?style=flat)](https://npmjs.org/package/arr-flatten) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/arr-flatten.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/arr-flatten) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/arr-flatten.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/arr-flatten) - -> Recursively flatten an array or arrays. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save arr-flatten -``` - -## Install - -Install with [bower](https://bower.io/) - -```sh -$ bower install arr-flatten --save -``` - -## Usage - -```js -var flatten = require('arr-flatten'); - -flatten(['a', ['b', ['c']], 'd', ['e']]); -//=> ['a', 'b', 'c', 'd', 'e'] -``` - -## Why another flatten utility? - -I wanted the fastest implementation I could find, with implementation choices that should work for 95% of use cases, but no cruft to cover the other 5%. - -## About - -### Related projects - -* [arr-filter](https://www.npmjs.com/package/arr-filter): Faster alternative to javascript's native filter method. | [homepage](https://github.com/jonschlinkert/arr-filter "Faster alternative to javascript's native filter method.") -* [arr-union](https://www.npmjs.com/package/arr-union): Combines a list of arrays, returning a single array with unique values, using strict equality… [more](https://github.com/jonschlinkert/arr-union) | [homepage](https://github.com/jonschlinkert/arr-union "Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.") -* [array-each](https://www.npmjs.com/package/array-each): Loop over each item in an array and call the given function on every element. | [homepage](https://github.com/jonschlinkert/array-each "Loop over each item in an array and call the given function on every element.") -* [array-unique](https://www.npmjs.com/package/array-unique): Remove duplicate values from an array. Fastest ES5 implementation. | [homepage](https://github.com/jonschlinkert/array-unique "Remove duplicate values from an array. Fastest ES5 implementation.") - -### Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -### Contributors - -| **Commits** | **Contributor** | -| --- | --- | -| 20 | [jonschlinkert](https://github.com/jonschlinkert) | -| 1 | [lukeed](https://github.com/lukeed) | - -### Building docs - -_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ - -To generate the readme, run the following command: - -```sh -$ npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -### Running tests - -Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: - -```sh -$ npm install && npm test -``` - -### Author - -**Jon Schlinkert** - -* [github/jonschlinkert](https://github.com/jonschlinkert) -* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) - -### License - -Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 05, 2017._ \ No newline at end of file diff --git a/server/node_modules/arr-flatten/index.js b/server/node_modules/arr-flatten/index.js deleted file mode 100644 index 0cb4ea4..0000000 --- a/server/node_modules/arr-flatten/index.js +++ /dev/null @@ -1,22 +0,0 @@ -/*! - * arr-flatten - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */ - -'use strict'; - -module.exports = function (arr) { - return flat(arr, []); -}; - -function flat(arr, res) { - var i = 0, cur; - var len = arr.length; - for (; i < len; i++) { - cur = arr[i]; - Array.isArray(cur) ? flat(cur, res) : res.push(cur); - } - return res; -} diff --git a/server/node_modules/arr-flatten/package.json b/server/node_modules/arr-flatten/package.json deleted file mode 100644 index 6fa18c2..0000000 --- a/server/node_modules/arr-flatten/package.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "_from": "arr-flatten@^1.1.0", - "_id": "arr-flatten@1.1.0", - "_inBundle": false, - "_integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", - "_location": "/arr-flatten", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "arr-flatten@^1.1.0", - "name": "arr-flatten", - "escapedName": "arr-flatten", - "rawSpec": "^1.1.0", - "saveSpec": null, - "fetchSpec": "^1.1.0" - }, - "_requiredBy": [ - "/image-pixels", - "/pxls", - "/to-uint8" - ], - "_resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "_shasum": "36048bbff4e7b47e136644316c99669ea5ae91f1", - "_spec": "arr-flatten@^1.1.0", - "_where": "/home/sigonasr2/divar/server/node_modules/image-pixels", - "author": { - "name": "Jon Schlinkert", - "url": "https://github.com/jonschlinkert" - }, - "bugs": { - "url": "https://github.com/jonschlinkert/arr-flatten/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Jon Schlinkert", - "url": "http://twitter.com/jonschlinkert" - }, - { - "name": "Luke Edwards", - "url": "https://lukeed.com" - } - ], - "deprecated": false, - "description": "Recursively flatten an array or arrays.", - "devDependencies": { - "ansi-bold": "^0.1.1", - "array-flatten": "^2.1.1", - "array-slice": "^1.0.0", - "benchmarked": "^1.0.0", - "compute-flatten": "^1.0.0", - "flatit": "^1.1.1", - "flatten": "^1.0.2", - "flatten-array": "^1.0.0", - "glob": "^7.1.1", - "gulp-format-md": "^0.1.12", - "just-flatten-it": "^1.1.23", - "lodash.flattendeep": "^4.4.0", - "m_flattened": "^1.0.1", - "mocha": "^3.2.0", - "utils-flatten": "^1.0.0", - "write": "^0.3.3" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/jonschlinkert/arr-flatten", - "keywords": [ - "arr", - "array", - "elements", - "flat", - "flatten", - "nested", - "recurse", - "recursive", - "recursively" - ], - "license": "MIT", - "main": "index.js", - "name": "arr-flatten", - "repository": { - "type": "git", - "url": "git+https://github.com/jonschlinkert/arr-flatten.git" - }, - "scripts": { - "test": "mocha" - }, - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "related": { - "list": [ - "arr-filter", - "arr-union", - "array-each", - "array-unique" - ] - }, - "lint": { - "reflinks": true - } - }, - "version": "1.1.0" -} diff --git a/server/node_modules/arraybuffer-to-string/.eslintrc.json b/server/node_modules/arraybuffer-to-string/.eslintrc.json deleted file mode 100644 index aaddba5..0000000 --- a/server/node_modules/arraybuffer-to-string/.eslintrc.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "env": { - "browser": true, - "node": true, - "commonjs": true, - "es6": true - }, - "extends": "eslint:recommended", - "rules": { - "strict": 2, - "indent": 0, - "linebreak-style": 0, - "quotes": 0, - "semi": 0, - "no-cond-assign": 1, - "no-constant-condition": 1, - "no-duplicate-case": 1, - "no-empty": 1, - "no-ex-assign": 1, - "no-extra-boolean-cast": 1, - "no-extra-semi": 1, - "no-fallthrough": 1, - "no-func-assign": 1, - "no-global-assign": 1, - "no-implicit-globals": 2, - "no-inner-declarations": ["error", "functions"], - "no-irregular-whitespace": 2, - "no-loop-func": 1, - "no-magic-numbers": ["warn", { "ignore": [1, 0, -1], "ignoreArrayIndexes": true}], - "no-multi-str": 1, - "no-mixed-spaces-and-tabs": 1, - "no-proto": 1, - "no-sequences": 1, - "no-throw-literal": 1, - "no-unmodified-loop-condition": 1, - "no-useless-call": 1, - "no-void": 1, - "no-with": 2, - "wrap-iife": 1, - "no-redeclare": 1, - "no-unused-vars": ["error", { "vars": "all", "args": "none" }], - "no-sparse-arrays": 1 - } -} diff --git a/server/node_modules/arraybuffer-to-string/.travis.yml b/server/node_modules/arraybuffer-to-string/.travis.yml deleted file mode 100644 index c8cd2d2..0000000 --- a/server/node_modules/arraybuffer-to-string/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - '6' - - '5' - - '4' diff --git a/server/node_modules/arraybuffer-to-string/browser.js b/server/node_modules/arraybuffer-to-string/browser.js deleted file mode 100644 index 52e2edf..0000000 --- a/server/node_modules/arraybuffer-to-string/browser.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @module arraybuffer-to-string/browser - */ - -'use strict' - -module.exports = function ArrayBufferToString (buffer, encoding) { - if (encoding == null) encoding = 'utf8' - - var uint8 = new Uint8Array(buffer) - - if (encoding === 'hex') { - var out = '' - for (var i = 0, l = uint8.byteLength; i < l; ++i) { - out += toHex(uint8[i]) - } - return out - } - - if (encoding === 'base64') { - str = String.fromCharCode.apply(null, uint8) - return btoa(str) - } - - if (encoding === 'binary' || - encoding === 'latin1' || - !global.TextDecoder) { - str = String.fromCharCode.apply(null, uint8) - return str - } - - - //TextDecoder way - if (encoding === 'utf16le') encoding = 'utf-16le' - - var decoder = new TextDecoder(encoding) - var str = decoder.decode(uint8) - return str -} - - -function toHex (n) { - if (n < 16) return '0' + n.toString(16) - return n.toString(16) -} diff --git a/server/node_modules/arraybuffer-to-string/index.js b/server/node_modules/arraybuffer-to-string/index.js deleted file mode 100644 index f4a57ae..0000000 --- a/server/node_modules/arraybuffer-to-string/index.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module arraybuffer-to-string - */ - -'use strict' - -module.exports = function ArrayBufferToString (buffer, encoding) { - if (encoding == null) encoding = 'utf8' - - return Buffer.from(buffer).toString(encoding) -} diff --git a/server/node_modules/arraybuffer-to-string/package.json b/server/node_modules/arraybuffer-to-string/package.json deleted file mode 100644 index 0a526ae..0000000 --- a/server/node_modules/arraybuffer-to-string/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "_from": "arraybuffer-to-string@^1.0.2", - "_id": "arraybuffer-to-string@1.0.2", - "_inBundle": false, - "_integrity": "sha512-WbIYlLVmvIAyUBdQRRuyGOJRriOQy9OAsWcyURmsRQp9+g647hdMSS2VFKXbJLVw0daUu06hqwLXm9etVrXI9A==", - "_location": "/arraybuffer-to-string", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "arraybuffer-to-string@^1.0.2", - "name": "arraybuffer-to-string", - "escapedName": "arraybuffer-to-string", - "rawSpec": "^1.0.2", - "saveSpec": null, - "fetchSpec": "^1.0.2" - }, - "_requiredBy": [ - "/image-pixels" - ], - "_resolved": "https://registry.npmjs.org/arraybuffer-to-string/-/arraybuffer-to-string-1.0.2.tgz", - "_shasum": "c373aa7bb0e6844d9a2bc9654c8889a9570a26e2", - "_spec": "arraybuffer-to-string@^1.0.2", - "_where": "/home/sigonasr2/divar/server/node_modules/image-pixels", - "author": { - "name": "Dima Yv", - "email": "dfcreative@gmail.com" - }, - "browser": "./browser.js", - "bugs": { - "url": "https://github.com/dfcreative/arraybuffer-to-string/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Convert ArrayBuffer to string", - "devDependencies": { - "buffer-to-arraybuffer": "0.0.4", - "is-browser": "^2.0.1", - "string-to-arraybuffer": "^1.0.0", - "tape": "^4.7.0" - }, - "homepage": "https://github.com/dfcreative/arraybuffer-to-string#readme", - "keywords": [ - "arraybuffer", - "array-buffer", - "array", - "buffer", - "string", - "base64", - "atob", - "btoa", - "datauri" - ], - "license": "MIT", - "main": "index.js", - "name": "arraybuffer-to-string", - "repository": { - "type": "git", - "url": "git+https://github.com/dfcreative/arraybuffer-to-string.git" - }, - "scripts": { - "test": "node test.js" - }, - "version": "1.0.2" -} diff --git a/server/node_modules/arraybuffer-to-string/readme.md b/server/node_modules/arraybuffer-to-string/readme.md deleted file mode 100644 index 4a92943..0000000 --- a/server/node_modules/arraybuffer-to-string/readme.md +++ /dev/null @@ -1,27 +0,0 @@ -# arraybuffer-to-string [![unstable](https://img.shields.io/badge/stability-unstable-orange.svg)](http://github.com/badges/stability-badges) [![Build Status](https://img.shields.io/travis/dfcreative/arraybuffer-to-string.svg)](https://travis-ci.org/dfcreative/arraybuffer-to-string) - -Convert _ArrayBuffer_ to string with optional encoding. - -[![npm install arraybuffer-to-string](https://nodei.co/npm/arraybuffer-to-string.png?mini=true)](https://npmjs.org/package/arraybuffer-to-string/) - -```js -var ab2str = require('arraybuffer-to-string') - -var uint8 = new Uint8Array([ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33 ]) - -ab2str(uint8) // 'Hello World!' -ab2str(uint8, 'base64') // 'SGVsbG8gV29ybGQh' -ab2str(uint8, 'hex') // '48656c6c6f20576f726c6421' -ab2str(uint8, 'iso-8859-2') // 'Hello World!' -``` - -### var str = arrayBufferToString(buffer, encoding='utf8') - -Convert ArrayBuffer/ArrayBufferView/Array `buffer` to string with defined encoding. Available encoding: `utf8`, `binary`, `base64`, `hex`, `ascii`, `latin1`, `ucs2`, `utf16` and [many others](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/encoding). - -Note: in browser it relies on [TextDecoder API](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/decode), so if you are dealing with charsets other than `utf8`, `ascii`, `binary` or `base64` in old browsers, please include [encoding polyfill](https://github.com/inexorabletash/text-encoding). - -### Related - -* [string-to-arraybuffer](https://github.com/dfcreative/string-to-arraybuffer) − convert string to arraybuffer. -* [create-data-uri](https://www.npmjs.com/package/create-data-uri) − convert binary data to datauri string. diff --git a/server/node_modules/arraybuffer-to-string/test.js b/server/node_modules/arraybuffer-to-string/test.js deleted file mode 100644 index 466ddb2..0000000 --- a/server/node_modules/arraybuffer-to-string/test.js +++ /dev/null @@ -1,257 +0,0 @@ -'use strict' - - -var toString = require('./'); -var t = require('tape') -var b2ab = require('buffer-to-arraybuffer') -var isBrowser = require('is-browser') -var str2ab = require('string-to-arraybuffer') - -t('basics', t => { - t.equal( - toString(new Uint8Array([ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33 ])), - 'Hello World!' - ) - t.end() -}) - -t('utf8 buffer to base64', function (t) { - t.equal( - toString(b2ab(Buffer.from('Ձאab', 'utf8')), 'base64'), - '1YHXkGFi' - ) - t.end() -}) - -t('utf8 buffer to hex', function (t) { - t.equal( - toString(b2ab(Buffer.from('Ձאab', 'utf8')), 'hex'), - 'd581d7906162' - ) - t.end() -}) - -t('utf8 to utf8', function (t) { - t.equal( - toString(b2ab(Buffer.from('öäüõÖÄÜÕ', 'utf8')), 'utf8'), - 'öäüõÖÄÜÕ' - ) - t.end() -}) - -t('utf16le to utf16', function (t) { - t.equal( - toString(b2ab(Buffer.from(toString(b2ab(Buffer.from('abcd', 'utf8')), 'utf16le'), 'utf16le')), 'utf8'), - 'abcd' - ) - t.end() -}) - -t('utf16le to hex', function (t) { - t.equal( - toString(b2ab(Buffer.from('abcd', 'utf16le')), 'hex'), - '6100620063006400' - ) - t.end() -}) - -t('ascii buffer to base64', function (t) { - t.equal( - toString(b2ab(Buffer.from('123456!@#$%^', 'ascii')), 'base64'), - 'MTIzNDU2IUAjJCVe' - ) - t.end() -}) - -t('ascii buffer to hex', function (t) { - t.equal( - toString(b2ab(Buffer.from('123456!@#$%^', 'ascii')), 'hex'), - '31323334353621402324255e' - ) - t.end() -}) - -t('base64 buffer to utf8', function (t) { - t.equal( - toString(b2ab(Buffer.from('1YHXkGFi', 'base64')), 'utf8'), - 'Ձאab' - ) - t.end() -}) - -t('hex buffer to utf8', function (t) { - t.equal( - toString(b2ab(Buffer.from('d581d7906162', 'hex')), 'utf8'), - 'Ձאab' - ) - t.end() -}) - -t('base64 buffer to ascii', function (t) { - t.equal( - toString(b2ab(Buffer.from('MTIzNDU2IUAjJCVe', 'base64')), 'ascii'), - '123456!@#$%^' - ) - t.end() -}) - -t('hex buffer to ascii', function (t) { - t.equal( - toString(b2ab(Buffer.from('31323334353621402324255e', 'hex')), 'ascii'), - '123456!@#$%^' - ) - t.end() -}) - -t('base64 buffer to binary', function (t) { - t.equal( - toString(b2ab(Buffer.from('MTIzNDU2IUAjJCVe', 'base64')), 'binary'), - '123456!@#$%^' - ) - t.end() -}) - -t('hex buffer to binary', function (t) { - t.equal( - toString(b2ab(Buffer.from('31323334353621402324255e', 'hex')), 'binary'), - '123456!@#$%^' - ) - t.end() -}) - -t('utf8 to binary', function (t) { - /* jshint -W100 */ - t.equal( - toString(b2ab(Buffer.from('öäüõÖÄÜÕ', 'utf8')), 'binary'), - 'öäüõÖÄÜÕ' - ) - /* jshint +W100 */ - t.end() -}) - -t('utf8 replacement chars (1 byte sequence)', function (t) { - t.equal( - toString(b2ab(Buffer.from([ 0x80 ])) ), - '\uFFFD' - ) - t.equal( - toString(b2ab(Buffer.from([ 0x7F ])) ), - '\u007F' - ) - t.end() -}) - -t('utf8 replacement chars (2 byte sequences)', function (t) { - t.equal( - toString(b2ab(Buffer.from([ 0xC7 ])) ), - '\uFFFD' - ) - t.equal( - toString(b2ab(Buffer.from([ 0xC7, 0xB1 ])) ), - '\u01F1' - ) - t.equal( - toString(b2ab(Buffer.from([ 0xC0, 0xB1 ])) ), - '\uFFFD\uFFFD' - ) - t.equal( - toString(b2ab(Buffer.from([ 0xC1, 0xB1 ])) ), - '\uFFFD\uFFFD' - ) - t.end() -}) - -//FIXME: browser-only case in some reason -isBrowser && t('utf8 replacement chars (3 byte sequences)', function (t) { - t.equal( - toString(b2ab(Buffer.from([ 0xE0 ])) ), - '\uFFFD' - ) - t.equal( - toString(Buffer.from([ 0xE0, 0xAC ]) ), - // new Buffer([ 0xE0, 0xAC ]).toString(), - '\uFFFD\uFFFD' - ) - t.equal( - toString(b2ab(Buffer.from([ 0xE0, 0xAC, 0xB9 ])) ), - '\u0B39' - ) - t.end() -}) - -isBrowser && t('utf8 replacement chars (4 byte sequences)', function (t) { - t.equal( - toString(b2ab(Buffer.from([ 0xF4 ])) ), - '\uFFFD' - ) - t.equal( - toString(b2ab(Buffer.from([ 0xF4, 0x8F ])) ), - '\uFFFD\uFFFD' - ) - t.equal( - toString(b2ab(Buffer.from([ 0xF4, 0x8F, 0x80 ])) ), - '\uFFFD\uFFFD\uFFFD' - ) - t.equal( - toString(b2ab(Buffer.from([ 0xF4, 0x8F, 0x80, 0x84 ])) ), - '\uDBFC\uDC04' - ) - t.equal( - toString(b2ab(Buffer.from([ 0xFF ])) ), - '\uFFFD' - ) - t.equal( - toString(b2ab(Buffer.from([ 0xFF, 0x8F, 0x80, 0x84 ])) ), - '\uFFFD\uFFFD\uFFFD\uFFFD' - ) - t.end() -}) - -t.skip('bad utf part', t => { - t.equal( - toString(new Uint8Array([236, 134, 219])), - '���' - ) - - t.end() -}) - -t.skip('utf8 replacement chars on 256 random bytes', function (t) { - t.equal( - toString(b2ab(Buffer.from([ 152, 130, 206, 23, 243, 238, 197, 44, 27, 86, 208, 36, 163, 184, 164, 21, 94, 242, 178, 46, 25, 26, 253, 178, 72, 147, 207, 112, 236, 68, 179, 190, 29, 83, 239, 147, 125, 55, 143, 19, 157, 68, 157, 58, 212, 224, 150, 39, 128, 24, 94, 225, 120, 121, 75, 192, 112, 19, 184, 142, 203, 36, 43, 85, 26, 147, 227, 139, 242, 186, 57, 78, 11, 102, 136, 117, 180, 210, 241, 92, 3, 215, 54, 167, 249, 1, 44, 225, 146, 86, 2, 42, 68, 21, 47, 238, 204, 153, 216, 252, 183, 66, 222, 255, 15, 202, 16, 51, 134, 1, 17, 19, 209, 76, 238, 38, 76, 19, 7, 103, 249, 5, 107, 137, 64, 62, 170, 57, 16, 85, 179, 193, 97, 86, 166, 196, 36, 148, 138, 193, 210, 69, 187, 38, 242, 97, 195, 219, 252, 244, 38, 1, 197, 18, 31, 246, 53, 47, 134, 52, 105, 72, 43, 239, 128, 203, 73, 93, 199, 75, 222, 220, 166, 34, 63, 236, 11, 212, 76, 243, 171, 110, 78, 39, 205, 204, 6, 177, 233, 212, 243, 0, 33, 41, 122, 118, 92, 252, 0, 157, 108, 120, 70, 137, 100, 223, 243, 171, 232, 66, 126, 111, 142, 33, 3, 39, 117, 27, 107, 54, 1, 217, 227, 132, 13, 166, 3, 73, 53, 127, 225, 236, 134, 219, 98, 214, 125, 148, 24, 64, 142, 111, 231, 194, 42, 150, 185, 10, 182, 163, 244, 19, 4, 59, 135, 16 ])) ), - '\uFFFD\uFFFD\uFFFD\u0017\uFFFD\uFFFD\uFFFD\u002C\u001B\u0056\uFFFD\u0024\uFFFD\uFFFD\uFFFD\u0015\u005E\uFFFD\uFFFD\u002E\u0019\u001A\uFFFD\uFFFD\u0048\uFFFD\uFFFD\u0070\uFFFD\u0044\uFFFD\uFFFD\u001D\u0053\uFFFD\uFFFD\u007D\u0037\uFFFD\u0013\uFFFD\u0044\uFFFD\u003A\uFFFD\uFFFD\uFFFD\u0027\uFFFD\u0018\u005E\uFFFD\u0078\u0079\u004B\uFFFD\u0070\u0013\uFFFD\uFFFD\uFFFD\u0024\u002B\u0055\u001A\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0039\u004E\u000B\u0066\uFFFD\u0075\uFFFD\uFFFD\uFFFD\u005C\u0003\uFFFD\u0036\uFFFD\uFFFD\u0001\u002C\uFFFD\uFFFD\u0056\u0002\u002A\u0044\u0015\u002F\uFFFD\u0319\uFFFD\uFFFD\uFFFD\u0042\uFFFD\uFFFD\u000F\uFFFD\u0010\u0033\uFFFD\u0001\u0011\u0013\uFFFD\u004C\uFFFD\u0026\u004C\u0013\u0007\u0067\uFFFD\u0005\u006B\uFFFD\u0040\u003E\uFFFD\u0039\u0010\u0055\uFFFD\uFFFD\u0061\u0056\uFFFD\uFFFD\u0024\uFFFD\uFFFD\uFFFD\uFFFD\u0045\uFFFD\u0026\uFFFD\u0061\uFFFD\uFFFD\uFFFD\uFFFD\u0026\u0001\uFFFD\u0012\u001F\uFFFD\u0035\u002F\uFFFD\u0034\u0069\u0048\u002B\uFFFD\uFFFD\uFFFD\u0049\u005D\uFFFD\u004B\uFFFD\u0726\u0022\u003F\uFFFD\u000B\uFFFD\u004C\uFFFD\uFFFD\u006E\u004E\u0027\uFFFD\uFFFD\u0006\uFFFD\uFFFD\uFFFD\uFFFD\u0000\u0021\u0029\u007A\u0076\u005C\uFFFD\u0000\uFFFD\u006C\u0078\u0046\uFFFD\u0064\uFFFD\uFFFD\uFFFD\uFFFD\u0042\u007E\u006F\uFFFD\u0021\u0003\u0027\u0075\u001B\u006B\u0036\u0001\uFFFD\uFFFD\uFFFD\u000D\uFFFD\u0003\u0049\u0035\u007F\uFFFD\uFFFD\uFFFD\uFFFD\u0062\uFFFD\u007D\uFFFD\u0018\u0040\uFFFD\u006F\uFFFD\uFFFD\u002A\uFFFD\uFFFD\u000A\uFFFD\uFFFD\uFFFD\u0013\u0004\u003B\uFFFD\u0010' - ) - t.end() -}) - -isBrowser && t('utf8 replacement chars for anything in the surrogate pair range', function (t) { - t.equal( - toString(b2ab(Buffer.from([ 0xED, 0x9F, 0xBF ])) ), - '\uD7FF' - ) - t.equal( - toString(b2ab(Buffer.from([ 0xED, 0xA0, 0x80 ])) ), - '\uFFFD\uFFFD\uFFFD' - ) - t.equal( - toString(b2ab(Buffer.from([ 0xED, 0xBE, 0x8B ])) ), - '\uFFFD\uFFFD\uFFFD' - ) - t.equal( - toString(b2ab(Buffer.from([ 0xED, 0xBF, 0xBF ])) ), - '\uFFFD\uFFFD\uFFFD' - ) - t.equal( - toString(b2ab(Buffer.from([ 0xEE, 0x80, 0x80 ])) ), - '\uE000' - ) - t.end() -}) - -t('utf8 don\'t replace the replacement char', function (t) { - t.equal( - toString(b2ab(Buffer.from('\uFFFD')) ), - '\uFFFD' - ) - t.end() -}) diff --git a/server/node_modules/atob-lite/.npmignore b/server/node_modules/atob-lite/.npmignore deleted file mode 100644 index 50c7458..0000000 --- a/server/node_modules/atob-lite/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -node_modules -*.log -.DS_Store -bundle.js -test -test.js diff --git a/server/node_modules/atob-lite/LICENSE.md b/server/node_modules/atob-lite/LICENSE.md deleted file mode 100644 index ee27ba4..0000000 --- a/server/node_modules/atob-lite/LICENSE.md +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under the MIT license: - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/atob-lite/README.md b/server/node_modules/atob-lite/README.md deleted file mode 100644 index 99ea05d..0000000 --- a/server/node_modules/atob-lite/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# atob-lite -![](http://img.shields.io/badge/stability-stable-orange.svg?style=flat) -![](http://img.shields.io/npm/v/atob-lite.svg?style=flat) -![](http://img.shields.io/npm/dm/atob-lite.svg?style=flat) -![](http://img.shields.io/npm/l/atob-lite.svg?style=flat) - -Smallest/simplest possible means of using atob with both Node and browserify. - -In the browser, decoding base64 strings is done using: - -``` javascript -var decoded = atob(encoded) -``` - -However in Node, it's done like so: - -``` javascript -var decoded = new Buffer(encoded, 'base64').toString('utf8') -``` - -You can easily check if `Buffer` exists and switch between the approaches -accordingly, but using `Buffer` anywhere in your browser source will pull -in browserify's `Buffer` shim which is pretty hefty. This package uses -the `main` and `browser` fields in its `package.json` to perform this -check at build time and avoid pulling `Buffer` in unnecessarily. - -## Usage - -[![NPM](https://nodei.co/npm/atob-lite.png)](https://nodei.co/npm/atob-lite/) - -### `decoded = atob(encoded)` - -Returns the decoded value of a base64-encoded string. - -## License - -MIT. See [LICENSE.md](http://github.com/hughsk/atob-lite/blob/master/LICENSE.md) for details. diff --git a/server/node_modules/atob-lite/atob-browser.js b/server/node_modules/atob-lite/atob-browser.js deleted file mode 100644 index cee1a38..0000000 --- a/server/node_modules/atob-lite/atob-browser.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function _atob(str) { - return atob(str) -} diff --git a/server/node_modules/atob-lite/atob-node.js b/server/node_modules/atob-lite/atob-node.js deleted file mode 100644 index 7072075..0000000 --- a/server/node_modules/atob-lite/atob-node.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function atob(str) { - return Buffer.from(str, 'base64').toString('binary') -} diff --git a/server/node_modules/atob-lite/package.json b/server/node_modules/atob-lite/package.json deleted file mode 100644 index 4d2b69c..0000000 --- a/server/node_modules/atob-lite/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "_from": "atob-lite@^2.0.0", - "_id": "atob-lite@2.0.0", - "_inBundle": false, - "_integrity": "sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY=", - "_location": "/atob-lite", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "atob-lite@^2.0.0", - "name": "atob-lite", - "escapedName": "atob-lite", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/string-to-arraybuffer" - ], - "_resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz", - "_shasum": "0fef5ad46f1bd7a8502c65727f0367d5ee43d696", - "_spec": "atob-lite@^2.0.0", - "_where": "/home/sigonasr2/divar/server/node_modules/string-to-arraybuffer", - "author": { - "name": "Hugh Kennedy", - "email": "hughskennedy@gmail.com", - "url": "http://hughsk.io/" - }, - "browser": "atob-browser.js", - "bugs": { - "url": "https://github.com/hughsk/atob-lite/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Smallest/simplest possible means of using atob with both Node and browserify", - "devDependencies": { - "browserify": "^10.2.4", - "smokestack": "^3.3.0", - "tap-closer": "^1.0.0", - "tap-spec": "^4.0.0", - "tape": "^4.0.0" - }, - "homepage": "https://github.com/hughsk/atob-lite", - "keywords": [ - "atob", - "base64", - "isomorphic", - "browser", - "node", - "shared" - ], - "license": "MIT", - "main": "atob-node.js", - "name": "atob-lite", - "repository": { - "type": "git", - "url": "git://github.com/hughsk/atob-lite.git" - }, - "scripts": { - "test": "npm run test-node && npm run test-browser", - "test-browser": "browserify test | smokestack | tap-spec", - "test-node": "node test | tap-spec" - }, - "version": "2.0.0" -} diff --git a/server/node_modules/bmp-js/.npmignore b/server/node_modules/bmp-js/.npmignore deleted file mode 100644 index 34977ee..0000000 --- a/server/node_modules/bmp-js/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -.idea \ No newline at end of file diff --git a/server/node_modules/bmp-js/LICENSE b/server/node_modules/bmp-js/LICENSE deleted file mode 100644 index 4b20aef..0000000 --- a/server/node_modules/bmp-js/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 @丝刀口 - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/server/node_modules/bmp-js/README.md b/server/node_modules/bmp-js/README.md deleted file mode 100644 index d5fa52b..0000000 --- a/server/node_modules/bmp-js/README.md +++ /dev/null @@ -1,44 +0,0 @@ -bmp-js -====== - -A pure javascript Bmp encoder and decoder for node.js - -Supports all bits decoding(1,4,8,16,24,32) and encoding with 24bit. - -##Install - - $ npm install bmp-js - - -How to use? ---- -###Decode BMP -```js -var bmp = require("bmp-js"); -var bmpBuffer = fs.readFileSync('bit24.bmp'); -var bmpData = bmp.decode(bmpBuffer); - -``` - -`bmpData` has all properties includes: - -1. fileSize,reserved,offset - -2. headerSize,width,height,planes,bitPP,compress,rawSize,hr,vr,colors,importantColors - -3. palette - -4. data-------byte array order by ABGR ABGR ABGR,4 bytes per pixel - - -###Encode RGB -```js -var bmp = require("bmp-js"); -//bmpData={data:Buffer,width:Number,height:Height} -var rawData = bmp.encode(bmpData);//default no compression,write rawData to .bmp file - -``` - -License ---- -U can use on free with [MIT License](https://github.com/shaozilee/bmp-js/blob/master/LICENSE) \ No newline at end of file diff --git a/server/node_modules/bmp-js/bmp-js.iml b/server/node_modules/bmp-js/bmp-js.iml deleted file mode 100644 index 8021953..0000000 --- a/server/node_modules/bmp-js/bmp-js.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/server/node_modules/bmp-js/index.js b/server/node_modules/bmp-js/index.js deleted file mode 100644 index dbb578c..0000000 --- a/server/node_modules/bmp-js/index.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * @author shaozilee - * - * support 1bit 4bit 8bit 24bit decode - * encode with 24bit - * - */ - -var encode = require('./lib/encoder'), - decode = require('./lib/decoder'); - -module.exports = { - encode: encode, - decode: decode -}; diff --git a/server/node_modules/bmp-js/lib/decoder.js b/server/node_modules/bmp-js/lib/decoder.js deleted file mode 100644 index b66d181..0000000 --- a/server/node_modules/bmp-js/lib/decoder.js +++ /dev/null @@ -1,485 +0,0 @@ -/** - * @author shaozilee - * - * Bmp format decoder,support 1bit 4bit 8bit 24bit bmp - * - */ - -function BmpDecoder(buffer,is_with_alpha) { - this.pos = 0; - this.buffer = buffer; - this.is_with_alpha = !!is_with_alpha; - this.bottom_up = true; - this.flag = this.buffer.toString("utf-8", 0, this.pos += 2); - if (this.flag != "BM") throw new Error("Invalid BMP File"); - this.parseHeader(); - this.parseRGBA(); -} - -BmpDecoder.prototype.parseHeader = function() { - this.fileSize = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.reserved = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.offset = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.headerSize = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.width = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.height = this.buffer.readInt32LE(this.pos); - this.pos += 4; - this.planes = this.buffer.readUInt16LE(this.pos); - this.pos += 2; - this.bitPP = this.buffer.readUInt16LE(this.pos); - this.pos += 2; - this.compress = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.rawSize = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.hr = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.vr = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.colors = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.importantColors = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - - if(this.bitPP === 16 && this.is_with_alpha){ - this.bitPP = 15 - } - if (this.bitPP < 15) { - var len = this.colors === 0 ? 1 << this.bitPP : this.colors; - this.palette = new Array(len); - for (var i = 0; i < len; i++) { - var blue = this.buffer.readUInt8(this.pos++); - var green = this.buffer.readUInt8(this.pos++); - var red = this.buffer.readUInt8(this.pos++); - var quad = this.buffer.readUInt8(this.pos++); - this.palette[i] = { - red: red, - green: green, - blue: blue, - quad: quad - }; - } - } - if(this.height < 0) { - this.height *= -1; - this.bottom_up = false; - } - -} - -BmpDecoder.prototype.parseRGBA = function() { - var bitn = "bit" + this.bitPP; - var len = this.width * this.height * 4; - this.data = new Buffer(len); - this[bitn](); -}; - -BmpDecoder.prototype.bit1 = function() { - var xlen = Math.ceil(this.width / 8); - var mode = xlen%4; - var y = this.height >= 0 ? this.height - 1 : -this.height - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y - for (var x = 0; x < xlen; x++) { - var b = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x*8*4; - for (var i = 0; i < 8; i++) { - if(x*8+i>(7-i))&0x1)]; - - this.data[location+i*4] = 0; - this.data[location+i*4 + 1] = rgb.blue; - this.data[location+i*4 + 2] = rgb.green; - this.data[location+i*4 + 3] = rgb.red; - - }else{ - break; - } - } - } - - if (mode != 0){ - this.pos+=(4 - mode); - } - } -}; - -BmpDecoder.prototype.bit4 = function() { - //RLE-4 - if(this.compress == 2){ - this.data.fill(0xff); - - var location = 0; - var lines = this.bottom_up?this.height-1:0; - var low_nibble = false;//for all count of pixel - - while(location>4); - } - - if ((i & 1) && (i+1 < b)){ - c = this.buffer.readUInt8(this.pos++); - } - - low_nibble = !low_nibble; - } - - if ((((b+1) >> 1) & 1 ) == 1){ - this.pos++ - } - } - - }else{//encoded mode - for (var i = 0; i < a; i++) { - if (low_nibble) { - setPixelData.call(this, (b & 0x0f)); - } else { - setPixelData.call(this, (b & 0xf0)>>4); - } - low_nibble = !low_nibble; - } - } - - } - - - - - function setPixelData(rgbIndex){ - var rgb = this.palette[rgbIndex]; - this.data[location] = 0; - this.data[location + 1] = rgb.blue; - this.data[location + 2] = rgb.green; - this.data[location + 3] = rgb.red; - location+=4; - } - }else{ - - var xlen = Math.ceil(this.width/2); - var mode = xlen%4; - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y - for (var x = 0; x < xlen; x++) { - var b = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x*2*4; - - var before = b>>4; - var after = b&0x0F; - - var rgb = this.palette[before]; - this.data[location] = 0; - this.data[location + 1] = rgb.blue; - this.data[location + 2] = rgb.green; - this.data[location + 3] = rgb.red; - - - if(x*2+1>=this.width)break; - - rgb = this.palette[after]; - - this.data[location+4] = 0; - this.data[location+4 + 1] = rgb.blue; - this.data[location+4 + 2] = rgb.green; - this.data[location+4 + 3] = rgb.red; - - } - - if (mode != 0){ - this.pos+=(4 - mode); - } - } - - } - -}; - -BmpDecoder.prototype.bit8 = function() { - //RLE-8 - if(this.compress == 1){ - this.data.fill(0xff); - - var location = 0; - var lines = this.bottom_up?this.height-1:0; - - while(location= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y - for (var x = 0; x < this.width; x++) { - var b = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x * 4; - if (b < this.palette.length) { - var rgb = this.palette[b]; - - this.data[location] = 0; - this.data[location + 1] = rgb.blue; - this.data[location + 2] = rgb.green; - this.data[location + 3] = rgb.red; - - } else { - this.data[location] = 0; - this.data[location + 1] = 0xFF; - this.data[location + 2] = 0xFF; - this.data[location + 3] = 0xFF; - } - } - if (mode != 0) { - this.pos += (4 - mode); - } - } - } -}; - -BmpDecoder.prototype.bit15 = function() { - var dif_w =this.width % 3; - var _11111 = parseInt("11111", 2),_1_5 = _11111; - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y - for (var x = 0; x < this.width; x++) { - - var B = this.buffer.readUInt16LE(this.pos); - this.pos+=2; - var blue = (B & _1_5) / _1_5 * 255 | 0; - var green = (B >> 5 & _1_5 ) / _1_5 * 255 | 0; - var red = (B >> 10 & _1_5) / _1_5 * 255 | 0; - var alpha = (B>>15)?0xFF:0x00; - - var location = line * this.width * 4 + x * 4; - - this.data[location] = alpha; - this.data[location + 1] = blue; - this.data[location + 2] = green; - this.data[location + 3] = red; - } - //skip extra bytes - this.pos += dif_w; - } -}; - -BmpDecoder.prototype.bit16 = function() { - var dif_w =(this.width % 2)*2; - //default xrgb555 - this.maskRed = 0x7C00; - this.maskGreen = 0x3E0; - this.maskBlue =0x1F; - this.mask0 = 0; - - if(this.compress == 3){ - this.maskRed = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.maskGreen = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.maskBlue = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.mask0 = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - } - - - var ns=[0,0,0]; - for (var i=0;i<16;i++){ - if ((this.maskRed>>i)&0x01) ns[0]++; - if ((this.maskGreen>>i)&0x01) ns[1]++; - if ((this.maskBlue>>i)&0x01) ns[2]++; - } - ns[1]+=ns[0]; ns[2]+=ns[1]; ns[0]=8-ns[0]; ns[1]-=8; ns[2]-=8; - - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y; - for (var x = 0; x < this.width; x++) { - - var B = this.buffer.readUInt16LE(this.pos); - this.pos+=2; - - var blue = (B&this.maskBlue)<>ns[1]; - var red = (B&this.maskRed)>>ns[2]; - - var location = line * this.width * 4 + x * 4; - - this.data[location] = 0; - this.data[location + 1] = blue; - this.data[location + 2] = green; - this.data[location + 3] = red; - } - //skip extra bytes - this.pos += dif_w; - } -}; - -BmpDecoder.prototype.bit24 = function() { - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y - for (var x = 0; x < this.width; x++) { - //Little Endian rgb - var blue = this.buffer.readUInt8(this.pos++); - var green = this.buffer.readUInt8(this.pos++); - var red = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x * 4; - this.data[location] = 0; - this.data[location + 1] = blue; - this.data[location + 2] = green; - this.data[location + 3] = red; - } - //skip extra bytes - this.pos += (this.width % 4); - } - -}; - -/** - * add 32bit decode func - * @author soubok - */ -BmpDecoder.prototype.bit32 = function() { - //BI_BITFIELDS - if(this.compress == 3){ - this.maskRed = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.maskGreen = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.maskBlue = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.mask0 = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y; - for (var x = 0; x < this.width; x++) { - //Little Endian rgba - var alpha = this.buffer.readUInt8(this.pos++); - var blue = this.buffer.readUInt8(this.pos++); - var green = this.buffer.readUInt8(this.pos++); - var red = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x * 4; - this.data[location] = alpha; - this.data[location + 1] = blue; - this.data[location + 2] = green; - this.data[location + 3] = red; - } - } - - }else{ - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y; - for (var x = 0; x < this.width; x++) { - //Little Endian argb - var blue = this.buffer.readUInt8(this.pos++); - var green = this.buffer.readUInt8(this.pos++); - var red = this.buffer.readUInt8(this.pos++); - var alpha = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x * 4; - this.data[location] = alpha; - this.data[location + 1] = blue; - this.data[location + 2] = green; - this.data[location + 3] = red; - } - } - - } - - - - -}; - -BmpDecoder.prototype.getData = function() { - return this.data; -}; - -module.exports = function(bmpData) { - var decoder = new BmpDecoder(bmpData); - return decoder; -}; diff --git a/server/node_modules/bmp-js/lib/encoder.js b/server/node_modules/bmp-js/lib/encoder.js deleted file mode 100644 index ddb3ef6..0000000 --- a/server/node_modules/bmp-js/lib/encoder.js +++ /dev/null @@ -1,81 +0,0 @@ -/** - * @author shaozilee - * - * BMP format encoder,encode 24bit BMP - * Not support quality compression - * - */ - -function BmpEncoder(imgData){ - this.buffer = imgData.data; - this.width = imgData.width; - this.height = imgData.height; - this.extraBytes = this.width%4; - this.rgbSize = this.height*(3*this.width+this.extraBytes); - this.headerInfoSize = 40; - - this.data = []; - /******************header***********************/ - this.flag = "BM"; - this.reserved = 0; - this.offset = 54; - this.fileSize = this.rgbSize+this.offset; - this.planes = 1; - this.bitPP = 24; - this.compress = 0; - this.hr = 0; - this.vr = 0; - this.colors = 0; - this.importantColors = 0; -} - -BmpEncoder.prototype.encode = function() { - var tempBuffer = new Buffer(this.offset+this.rgbSize); - this.pos = 0; - tempBuffer.write(this.flag,this.pos,2);this.pos+=2; - tempBuffer.writeUInt32LE(this.fileSize,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.reserved,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.offset,this.pos);this.pos+=4; - - tempBuffer.writeUInt32LE(this.headerInfoSize,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.width,this.pos);this.pos+=4; - tempBuffer.writeInt32LE(-this.height,this.pos);this.pos+=4; - tempBuffer.writeUInt16LE(this.planes,this.pos);this.pos+=2; - tempBuffer.writeUInt16LE(this.bitPP,this.pos);this.pos+=2; - tempBuffer.writeUInt32LE(this.compress,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.rgbSize,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.hr,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.vr,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.colors,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.importantColors,this.pos);this.pos+=4; - - var i=0; - var rowBytes = 3*this.width+this.extraBytes; - - for (var y = 0; y 0){ - var fillOffset = this.pos+y*rowBytes+this.width*3; - tempBuffer.fill(0,fillOffset,fillOffset+this.extraBytes); - } - } - - return tempBuffer; -}; - -module.exports = function(imgData, quality) { - if (typeof quality === 'undefined') quality = 100; - var encoder = new BmpEncoder(imgData); - var data = encoder.encode(); - return { - data: data, - width: imgData.width, - height: imgData.height - }; -}; diff --git a/server/node_modules/bmp-js/package.json b/server/node_modules/bmp-js/package.json deleted file mode 100644 index 05081bc..0000000 --- a/server/node_modules/bmp-js/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "_from": "bmp-js@^0.1.0", - "_id": "bmp-js@0.1.0", - "_inBundle": false, - "_integrity": "sha1-4Fpj95amwf8l9Hcex62twUjAcjM=", - "_location": "/bmp-js", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "bmp-js@^0.1.0", - "name": "bmp-js", - "escapedName": "bmp-js", - "rawSpec": "^0.1.0", - "saveSpec": null, - "fetchSpec": "^0.1.0" - }, - "_requiredBy": [ - "/image-decode" - ], - "_resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz", - "_shasum": "e05a63f796a6c1ff25f4771ec7adadc148c07233", - "_spec": "bmp-js@^0.1.0", - "_where": "/home/sigonasr2/divar/server/node_modules/image-decode", - "author": { - "name": "shaozilee", - "email": "shaozilee@gmail.com" - }, - "bugs": { - "url": "https://github.com/shaozilee/bmp-js/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "A pure javascript BMP encoder and decoder", - "devDependencies": {}, - "homepage": "https://github.com/shaozilee/bmp-js#readme", - "keywords": [ - "bmp", - "1bit", - "4bit", - "8bit", - "16bit", - "24bit", - "32bit", - "encoder", - "decoder", - "image", - "javascript", - "js" - ], - "license": "MIT", - "main": "index.js", - "name": "bmp-js", - "repository": { - "type": "git", - "url": "git+https://github.com/shaozilee/bmp-js.git" - }, - "version": "0.1.0" -} diff --git a/server/node_modules/bmp-js/test/bit1.bmp b/server/node_modules/bmp-js/test/bit1.bmp deleted file mode 100644 index c33b94d..0000000 Binary files a/server/node_modules/bmp-js/test/bit1.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit16_565.bmp b/server/node_modules/bmp-js/test/bit16_565.bmp deleted file mode 100644 index f111172..0000000 Binary files a/server/node_modules/bmp-js/test/bit16_565.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit16_565_out.bmp b/server/node_modules/bmp-js/test/bit16_565_out.bmp deleted file mode 100644 index a618d6f..0000000 Binary files a/server/node_modules/bmp-js/test/bit16_565_out.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit16_a444.bmp b/server/node_modules/bmp-js/test/bit16_a444.bmp deleted file mode 100644 index 7eabc66..0000000 Binary files a/server/node_modules/bmp-js/test/bit16_a444.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit16_a444_out.bmp b/server/node_modules/bmp-js/test/bit16_a444_out.bmp deleted file mode 100644 index 413b818..0000000 Binary files a/server/node_modules/bmp-js/test/bit16_a444_out.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit16_a555.bmp b/server/node_modules/bmp-js/test/bit16_a555.bmp deleted file mode 100644 index 8f28347..0000000 Binary files a/server/node_modules/bmp-js/test/bit16_a555.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit16_a555_out.bmp b/server/node_modules/bmp-js/test/bit16_a555_out.bmp deleted file mode 100644 index 6435286..0000000 Binary files a/server/node_modules/bmp-js/test/bit16_a555_out.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit16_x444.bmp b/server/node_modules/bmp-js/test/bit16_x444.bmp deleted file mode 100644 index 3afabae..0000000 Binary files a/server/node_modules/bmp-js/test/bit16_x444.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit16_x444_out.bmp b/server/node_modules/bmp-js/test/bit16_x444_out.bmp deleted file mode 100644 index 413b818..0000000 Binary files a/server/node_modules/bmp-js/test/bit16_x444_out.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit16_x555.bmp b/server/node_modules/bmp-js/test/bit16_x555.bmp deleted file mode 100644 index 077122e..0000000 Binary files a/server/node_modules/bmp-js/test/bit16_x555.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit16_x555_out.bmp b/server/node_modules/bmp-js/test/bit16_x555_out.bmp deleted file mode 100644 index 6435286..0000000 Binary files a/server/node_modules/bmp-js/test/bit16_x555_out.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit1_out.bmp b/server/node_modules/bmp-js/test/bit1_out.bmp deleted file mode 100644 index 830c379..0000000 Binary files a/server/node_modules/bmp-js/test/bit1_out.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit24.bmp b/server/node_modules/bmp-js/test/bit24.bmp deleted file mode 100644 index 9dcaba9..0000000 Binary files a/server/node_modules/bmp-js/test/bit24.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit24_out.bmp b/server/node_modules/bmp-js/test/bit24_out.bmp deleted file mode 100644 index 3a9aa82..0000000 Binary files a/server/node_modules/bmp-js/test/bit24_out.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit32.bmp b/server/node_modules/bmp-js/test/bit32.bmp deleted file mode 100644 index 411a176..0000000 Binary files a/server/node_modules/bmp-js/test/bit32.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit32_alpha.bmp b/server/node_modules/bmp-js/test/bit32_alpha.bmp deleted file mode 100644 index 57acdbe..0000000 Binary files a/server/node_modules/bmp-js/test/bit32_alpha.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit32_alpha_out.bmp b/server/node_modules/bmp-js/test/bit32_alpha_out.bmp deleted file mode 100644 index 3a9aa82..0000000 Binary files a/server/node_modules/bmp-js/test/bit32_alpha_out.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit32_out.bmp b/server/node_modules/bmp-js/test/bit32_out.bmp deleted file mode 100644 index 3a9aa82..0000000 Binary files a/server/node_modules/bmp-js/test/bit32_out.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit4.bmp b/server/node_modules/bmp-js/test/bit4.bmp deleted file mode 100644 index 665349b..0000000 Binary files a/server/node_modules/bmp-js/test/bit4.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit4_RLE.bmp b/server/node_modules/bmp-js/test/bit4_RLE.bmp deleted file mode 100644 index faf74b5..0000000 Binary files a/server/node_modules/bmp-js/test/bit4_RLE.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit4_RLE_out.bmp b/server/node_modules/bmp-js/test/bit4_RLE_out.bmp deleted file mode 100644 index 839e830..0000000 Binary files a/server/node_modules/bmp-js/test/bit4_RLE_out.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit4_out.bmp b/server/node_modules/bmp-js/test/bit4_out.bmp deleted file mode 100644 index 5198720..0000000 Binary files a/server/node_modules/bmp-js/test/bit4_out.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit8.bmp b/server/node_modules/bmp-js/test/bit8.bmp deleted file mode 100644 index 9d7c706..0000000 Binary files a/server/node_modules/bmp-js/test/bit8.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit8_RLE.bmp b/server/node_modules/bmp-js/test/bit8_RLE.bmp deleted file mode 100644 index e959d98..0000000 Binary files a/server/node_modules/bmp-js/test/bit8_RLE.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit8_RLE_out.bmp b/server/node_modules/bmp-js/test/bit8_RLE_out.bmp deleted file mode 100644 index 0ce584b..0000000 Binary files a/server/node_modules/bmp-js/test/bit8_RLE_out.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/bit8_out.bmp b/server/node_modules/bmp-js/test/bit8_out.bmp deleted file mode 100644 index 6ffcb1d..0000000 Binary files a/server/node_modules/bmp-js/test/bit8_out.bmp and /dev/null differ diff --git a/server/node_modules/bmp-js/test/test.js b/server/node_modules/bmp-js/test/test.js deleted file mode 100644 index 239a777..0000000 --- a/server/node_modules/bmp-js/test/test.js +++ /dev/null @@ -1,33 +0,0 @@ -var fs = require("fs"); - -var coder = require("../index.js"); -var bmps = ["./bit1", "./bit4", "./bit4_RLE", "./bit8", "./bit8_RLE", "./bit16_565", "./bit16_a444", "./bit16_a555", "./bit16_x444", "./bit16_x555", "./bit24", "./bit32", "./bit32_alpha"]; - -console.log("test bmp decoding and encoding..."); - -for(var b=0; b=0.4.0" - }, - "homepage": "https://github.com/substack/node-buffer-equal#readme", - "keywords": [ - "buffer", - "equal" - ], - "license": "MIT", - "main": "index.js", - "name": "buffer-equal", - "repository": { - "type": "git", - "url": "git://github.com/substack/node-buffer-equal.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "version": "0.0.1" -} diff --git a/server/node_modules/buffer-equal/test/eq.js b/server/node_modules/buffer-equal/test/eq.js deleted file mode 100644 index 3d34006..0000000 --- a/server/node_modules/buffer-equal/test/eq.js +++ /dev/null @@ -1,35 +0,0 @@ -var bufferEqual = require('../'); -var test = require('tap').test; - -test('equal', function (t) { - var eq = bufferEqual( - new Buffer([253,254,255]), - new Buffer([253,254,255]) - ); - t.strictEqual(eq, true); - t.end(); -}); - -test('not equal', function (t) { - var eq = bufferEqual( - new Buffer('abc'), - new Buffer('abcd') - ); - t.strictEqual(eq, false); - t.end(); -}); - -test('not equal not buffer', function (t) { - var eq = bufferEqual( - new Buffer('abc'), - 'abc' - ); - t.strictEqual(eq, undefined); - t.end(); -}); - -test('equal not buffer', function (t) { - var eq = bufferEqual('abc', 'abc'); - t.strictEqual(eq, undefined); - t.end(); -}); diff --git a/server/node_modules/buffer-to-uint8array/LICENSE b/server/node_modules/buffer-to-uint8array/LICENSE deleted file mode 100644 index ee27ba4..0000000 --- a/server/node_modules/buffer-to-uint8array/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under the MIT license: - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/buffer-to-uint8array/example/buf.js b/server/node_modules/buffer-to-uint8array/example/buf.js deleted file mode 100644 index 5391a9e..0000000 --- a/server/node_modules/buffer-to-uint8array/example/buf.js +++ /dev/null @@ -1,5 +0,0 @@ -var tou8 = require('../'); -var buf = new Buffer('whatever'); -var a = tou8(buf); -console.log(a.constructor.name); -console.log(a); diff --git a/server/node_modules/buffer-to-uint8array/index.js b/server/node_modules/buffer-to-uint8array/index.js deleted file mode 100644 index 669ffdf..0000000 --- a/server/node_modules/buffer-to-uint8array/index.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = function (buf) { - if (!buf) return undefined; - if (buf.constructor.name === 'Uint8Array' - || buf.constructor === Uint8Array) { - return buf; - } - if (typeof buf === 'string') buf = Buffer(buf); - var a = new Uint8Array(buf.length); - for (var i = 0; i < buf.length; i++) a[i] = buf[i]; - return a; -}; diff --git a/server/node_modules/buffer-to-uint8array/package.json b/server/node_modules/buffer-to-uint8array/package.json deleted file mode 100644 index 7663d9f..0000000 --- a/server/node_modules/buffer-to-uint8array/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "_from": "buffer-to-uint8array@^1.1.0", - "_id": "buffer-to-uint8array@1.1.0", - "_inBundle": false, - "_integrity": "sha1-z29BKHwCL0WNp1LDkcGo1TXsX3I=", - "_location": "/buffer-to-uint8array", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "buffer-to-uint8array@^1.1.0", - "name": "buffer-to-uint8array", - "escapedName": "buffer-to-uint8array", - "rawSpec": "^1.1.0", - "saveSpec": null, - "fetchSpec": "^1.1.0" - }, - "_requiredBy": [ - "/image-decode" - ], - "_resolved": "https://registry.npmjs.org/buffer-to-uint8array/-/buffer-to-uint8array-1.1.0.tgz", - "_shasum": "cf6f41287c022f458da752c391c1a8d535ec5f72", - "_spec": "buffer-to-uint8array@^1.1.0", - "_where": "/home/sigonasr2/divar/server/node_modules/image-decode", - "author": { - "name": "substack" - }, - "bugs": { - "url": "https://github.com/substack/buffer-to-uint8array/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "convert a buffer (or string) to a Uint8Array", - "devDependencies": { - "tape": "^4.0.0" - }, - "directories": { - "example": "example", - "test": "test" - }, - "homepage": "https://github.com/substack/buffer-to-uint8array#readme", - "keywords": [ - "Uint8Array", - "u8", - "byte", - "buffer", - "typedarray" - ], - "license": "MIT", - "main": "index.js", - "name": "buffer-to-uint8array", - "repository": { - "type": "git", - "url": "git://github.com/substack/buffer-to-uint8array.git" - }, - "scripts": { - "test": "tape test/*.js" - }, - "version": "1.1.0" -} diff --git a/server/node_modules/buffer-to-uint8array/readme.markdown b/server/node_modules/buffer-to-uint8array/readme.markdown deleted file mode 100644 index 161bd36..0000000 --- a/server/node_modules/buffer-to-uint8array/readme.markdown +++ /dev/null @@ -1,37 +0,0 @@ -# buffer-to-uint8array - -convert a buffer (or string) to a Uint8Array - -# example - -``` js -var tou8 = require('buffer-to-uint8array'); -var buf = new Buffer('whatever'); -var a = tou8(buf); -console.log(a.constructor.name); -console.log(a); -``` - -# methods - -``` js -var tou8 = require('buffer-to-uint8array') -``` - -## var u = tou8(buf) - -Convert `buf`, a `Buffer` or `string` to a `Uint8Array`. - -If `buf` is already a Uint8Array, it will be returned. - -# install - -With [npm](https://npmjs.org) do: - -``` -npm install buffer-to-uint8array -``` - -# license - -MIT diff --git a/server/node_modules/buffer-to-uint8array/test/buf.js b/server/node_modules/buffer-to-uint8array/test/buf.js deleted file mode 100644 index 27f2f30..0000000 --- a/server/node_modules/buffer-to-uint8array/test/buf.js +++ /dev/null @@ -1,10 +0,0 @@ -var test = require('tape'); -var tou8 = require('../'); - -test('buffer to uint8', function (t) { - t.plan(2); - var buf = new Buffer('whatever'); - var a = tou8(buf); - t.equal(a.constructor.name, 'Uint8Array', 'constructor name'); - t.equal(a.length, 8, 'buffer length'); -}); diff --git a/server/node_modules/buffer-to-uint8array/test/str.js b/server/node_modules/buffer-to-uint8array/test/str.js deleted file mode 100644 index de1f61c..0000000 --- a/server/node_modules/buffer-to-uint8array/test/str.js +++ /dev/null @@ -1,10 +0,0 @@ -var test = require('tape'); -var tou8 = require('../'); - -test('string to uint8', function (t) { - t.plan(2); - var str = 'whatever'; - var a = tou8(str); - t.equal(a.constructor.name, 'Uint8Array', 'constructor name'); - t.equal(a.length, 8, 'length'); -}); diff --git a/server/node_modules/buffer-to-uint8array/test/u8.js b/server/node_modules/buffer-to-uint8array/test/u8.js deleted file mode 100644 index b40865f..0000000 --- a/server/node_modules/buffer-to-uint8array/test/u8.js +++ /dev/null @@ -1,15 +0,0 @@ -var test = require('tape'); -var tou8 = require('../'); - -test('uint8 to uint8', function (t) { - t.plan(3); - var a = new Uint8Array(8); - var buf = Buffer('whatever'); - for (var i = 0; i < buf.length; i++) a[i] = buf[i]; - - var b = tou8(a); - - t.equal(a, b, 'reference equality'); - t.equal(a.constructor.name, 'Uint8Array', 'constructor name'); - t.equal(a.length, 8, 'u8 length'); -}); diff --git a/server/node_modules/clamp/.npmignore b/server/node_modules/clamp/.npmignore deleted file mode 100644 index eb03e3e..0000000 --- a/server/node_modules/clamp/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -*.log diff --git a/server/node_modules/clamp/LICENSE.md b/server/node_modules/clamp/LICENSE.md deleted file mode 100644 index deb759d..0000000 --- a/server/node_modules/clamp/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -## The MIT License (MIT) ## - -Copyright (c) 2013 Hugh Kennedy - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/server/node_modules/clamp/README.md b/server/node_modules/clamp/README.md deleted file mode 100644 index 6827a8e..0000000 --- a/server/node_modules/clamp/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# clamp [![frozen](http://hughsk.github.io/stability-badges/dist/frozen.svg)](http://github.com/hughsk/stability-badges) # - -Clamp a value between two other values. It's as simple as modules come - saving -keystrokes because I've had to write this function too many times. - -## Usage ## - -[![clamp](https://nodei.co/npm/clamp.png?mini=true)](https://nodei.co/npm/clamp) - -### `clamp(value, a, b)` ### - -Returns `value`, if it is between `a` and `b`. Otherwise, returns the number -it's gone past. - -## License ## - -MIT. See [LICENSE.md](http://github.com/hughsk/clamp/blob/master/LICENSE.md) for details. diff --git a/server/node_modules/clamp/index.js b/server/node_modules/clamp/index.js deleted file mode 100644 index 3c3b77c..0000000 --- a/server/node_modules/clamp/index.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = clamp - -function clamp(value, min, max) { - return min < max - ? (value < min ? min : value > max ? max : value) - : (value < max ? max : value > min ? min : value) -} diff --git a/server/node_modules/clamp/package.json b/server/node_modules/clamp/package.json deleted file mode 100644 index 88924ff..0000000 --- a/server/node_modules/clamp/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "_from": "clamp@^1.0.1", - "_id": "clamp@1.0.1", - "_inBundle": false, - "_integrity": "sha1-ZqDmQBGBbjcZaCj9yMjBRzEshjQ=", - "_location": "/clamp", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "clamp@^1.0.1", - "name": "clamp", - "escapedName": "clamp", - "rawSpec": "^1.0.1", - "saveSpec": null, - "fetchSpec": "^1.0.1" - }, - "_requiredBy": [ - "/to-uint8" - ], - "_resolved": "https://registry.npmjs.org/clamp/-/clamp-1.0.1.tgz", - "_shasum": "66a0e64011816e37196828fdc8c8c147312c8634", - "_spec": "clamp@^1.0.1", - "_where": "/home/sigonasr2/divar/server/node_modules/to-uint8", - "author": { - "name": "Hugh Kennedy", - "email": "hughskennedy@gmail.com", - "url": "http://github.com/hughsk" - }, - "browser": "index.js", - "bugs": { - "url": "https://github.com/hughsk/clamp/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Clamp a value between two other values", - "devDependencies": { - "tape": "~2.0.0" - }, - "homepage": "https://github.com/hughsk/clamp#readme", - "keywords": [ - "clamp", - "math", - "greater", - "less", - "than", - "between" - ], - "license": "MIT", - "main": "index.js", - "name": "clamp", - "repository": { - "type": "git", - "url": "git://github.com/hughsk/clamp.git" - }, - "scripts": { - "test": "node test" - }, - "version": "1.0.1" -} diff --git a/server/node_modules/clamp/test.js b/server/node_modules/clamp/test.js deleted file mode 100644 index c03c0a5..0000000 --- a/server/node_modules/clamp/test.js +++ /dev/null @@ -1,11 +0,0 @@ -var test = require('tape') -var clamp = require('./') - -test('clamp', function(t) { - t.equal(clamp(0, -100, 100), 0) - t.equal(clamp(0, 100, 100), 100) - t.equal(clamp(0, 100, -100), 0) - t.equal(clamp(100, 0, 50), 50) - t.equal(clamp(50, 100, 150), 100) - t.end() -}) diff --git a/server/node_modules/clip-pixels/.eslintrc.json b/server/node_modules/clip-pixels/.eslintrc.json deleted file mode 100644 index 1e5e08b..0000000 --- a/server/node_modules/clip-pixels/.eslintrc.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "env": { - "browser": true, - "node": true, - "commonjs": true, - "es6": true - }, - "extends": "eslint:recommended", - "rules": { - "strict": 2, - "indent": 0, - "linebreak-style": 0, - "quotes": 0, - "semi": 0, - "no-cond-assign": 1, - "no-constant-condition": 1, - "no-duplicate-case": 1, - "no-empty": 1, - "no-ex-assign": 1, - "no-extra-boolean-cast": 1, - "no-extra-semi": 1, - "no-fallthrough": 1, - "no-func-assign": 1, - "no-global-assign": 1, - "no-implicit-globals": 2, - "no-inner-declarations": ["error", "functions"], - "no-irregular-whitespace": 2, - "no-loop-func": 1, - "no-magic-numbers": ["warn", { "ignore": [1, 0, -1], "ignoreArrayIndexes": true}], - "no-multi-str": 1, - "no-mixed-spaces-and-tabs": 1, - "no-proto": 1, - "no-sequences": 1, - "no-throw-literal": 1, - "no-unmodified-loop-condition": 1, - "no-useless-call": 1, - "no-void": 1, - "no-with": 2, - "wrap-iife": 1, - "no-redeclare": 1, - "no-unused-vars": ["error", { "vars": "all", "args": "none" }], - "no-sparse-arrays": 1 - } -} diff --git a/server/node_modules/clip-pixels/.travis.yml b/server/node_modules/clip-pixels/.travis.yml deleted file mode 100644 index 2c956da..0000000 --- a/server/node_modules/clip-pixels/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -sudo: false -language: node_js -node_js: - - "6" - - "5" - - "4" - - "0.12" - - "0.10" -matrix: - fast_finish: true - allow_failures: - - node_js: "0.10" - - node_js: "0.12" diff --git a/server/node_modules/clip-pixels/index.js b/server/node_modules/clip-pixels/index.js deleted file mode 100644 index ab7abf0..0000000 --- a/server/node_modules/clip-pixels/index.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict' - -module.exports = function clip (pixels, shape, rect) { - var stride = shape[2] || 4 - var row = shape[0], - col = shape[1] || Math.floor(pixels.length / stride / row) - var x = rect[0], - y = rect[1] || 0, - w = rect[2] || row - x, - h = rect[3] || col - y - - var result = Array(w * stride * h) - - var off = y * row * stride + x * stride - for (var j = 0; j < h; j++) { - for (var i = 0; i < w; i++) { - for (var k = 0; k < stride; k++) { - result[j * w * stride + i * stride + k] = pixels[off + j * row * stride + i * stride + k] - } - } - } - - return result -} diff --git a/server/node_modules/clip-pixels/package.json b/server/node_modules/clip-pixels/package.json deleted file mode 100644 index 7149788..0000000 --- a/server/node_modules/clip-pixels/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "_from": "clip-pixels@^1.0.1", - "_id": "clip-pixels@1.0.1", - "_inBundle": false, - "_integrity": "sha512-nJ22fZvCwkJfMppkOEE7GciLX08rDnVzEJ+U46kBFZtwNzH2V4tNxMWa9Tc365WspCxy1c3NtGJ5EeT4SgjmCA==", - "_location": "/clip-pixels", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "clip-pixels@^1.0.1", - "name": "clip-pixels", - "escapedName": "clip-pixels", - "rawSpec": "^1.0.1", - "saveSpec": null, - "fetchSpec": "^1.0.1" - }, - "_requiredBy": [ - "/image-pixels" - ], - "_resolved": "https://registry.npmjs.org/clip-pixels/-/clip-pixels-1.0.1.tgz", - "_shasum": "c6304c5b82f6a5b555f1a5990a1cde84077614f8", - "_spec": "clip-pixels@^1.0.1", - "_where": "/home/sigonasr2/divar/server/node_modules/image-pixels", - "author": { - "name": "dy" - }, - "bugs": { - "url": "https://github.com/dy/clip-pixels/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Slice rectangle from pixels array", - "homepage": "https://github.com/dy/clip-pixels#readme", - "keywords": [ - "clip", - "slice", - "ndarray", - "flip-pixels", - "pxls", - "pixels" - ], - "license": "MIT", - "main": "index.js", - "name": "clip-pixels", - "repository": { - "type": "git", - "url": "git+https://github.com/dy/clip-pixels.git" - }, - "scripts": { - "test": "node test" - }, - "version": "1.0.1" -} diff --git a/server/node_modules/clip-pixels/readme.md b/server/node_modules/clip-pixels/readme.md deleted file mode 100644 index 66fcaa0..0000000 --- a/server/node_modules/clip-pixels/readme.md +++ /dev/null @@ -1,22 +0,0 @@ -[![Build Status](https://travis-ci.org/dy/clip-pixels.svg?branch=master)](https://travis-ci.org/dy/clip-pixels) - -Slice rectangle from an array with pixels. - -### `clip(arr, shape=[w, h?, channels=4], rect=[x, y?, w?, h?])` - -```js -var clip = require('clip-pixels') - -var pixels = [ -0, 1, 0, -1, 1, 1, -0, 1, 0 -] -pixels = clip(pixels, [3, 3, 1], [1, 0, 2, 3]) - -/* -1, 0, -1, 1, -1, 0 -*/ -``` diff --git a/server/node_modules/clip-pixels/test.js b/server/node_modules/clip-pixels/test.js deleted file mode 100644 index c2bd6f2..0000000 --- a/server/node_modules/clip-pixels/test.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict' - -var clip = require('./') -var a = require('assert') - - -var pixels = [ -0, 1, 0, -1, 1, 1, -0, 1, 0 -] -a.deepEqual(clip(pixels, [3, 3, 1], [1, 0, 2, 3]), -[ -1, 0, -1, 1, -1, 0 -]) - - -// short args -var pixels = [ -0,0,0,0, 1,1,1,1, 0,0,0,0, -1,1,1,1, 1,1,1,1, 1,1,1,1, -0,0,0,0, 1,1,1,1, 0,0,0,0 -] -a.deepEqual(clip(pixels, [3], [1, 0]), -[ -1,1,1,1, 0,0,0,0, -1,1,1,1, 1,1,1,1, -1,1,1,1, 0,0,0,0 -]) diff --git a/server/node_modules/compute-dims/LICENSE b/server/node_modules/compute-dims/LICENSE deleted file mode 100644 index 93cf2ea..0000000 --- a/server/node_modules/compute-dims/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2015 The Compute.io Authors. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/server/node_modules/compute-dims/README.md b/server/node_modules/compute-dims/README.md deleted file mode 100644 index f85ee77..0000000 --- a/server/node_modules/compute-dims/README.md +++ /dev/null @@ -1,137 +0,0 @@ -dims -=== -[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Dependencies][dependencies-image]][dependencies-url] - -> Computes dimensions for arrays and matrices. - - -## Installation - -``` bash -$ npm install compute-dims -``` - -For use in the browser, use [browserify](https://github.com/substack/node-browserify). - - -## Usage - - -``` javascript -var dims = require( 'compute-dims' ); -``` - -#### dims( x[, max] ) - -Computes dimensions of `x`. `x` may be either an [`array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) (including nested `arrays`) or a [`matrix`](https://github.com/dstructs/matrix). - -``` javascript -var matrix = require( 'dstructs-matrix' ), - data, - d; - -data = [ 1, 2 ]; -d = dims( data ); -// returns [2] - -data = [ [1,2], [1,2] ]; -d = dims( data ); -// returns [2,2] - -data = matrix( [1,2,3,4], [2,2] ) -d = dims( data ); -// returns [2,2] -``` - -If an `array` element has a dimension inconsistent with other elements, the function returns `null`. - -``` javascript -data = [ [1,2], [1] ]; -d = dims( data ); -// returns null -``` - -To limit the number of dimensions returned, set the `max` option. - -``` javascript -data = [ [[1,2], [3,4]] ]; // 1x2x2 -d = dims( data, 2 ); -// returns [1,2] - -data = [ [[1,2], [3,4,5,6,7,8]] ]; -d = dims( data ); -// returns null - -d = dims( data, 2 ); -// returns [1,2] - -data = matrix( [1,2,3,4], [2,2] ); -d = dims( data, 1 ); -// returns [2] -``` - - -## Examples - -To run the example code from the top-level application directory, - -``` bash -$ node ./examples/index.js -``` - - -## Tests - -### Unit - -Unit tests use the [Mocha](http://mochajs.org) test framework with [Chai](http://chaijs.com) assertions. To run the tests, execute the following command in the top-level application directory: - -``` bash -$ make test -``` - -All new feature development should have corresponding unit tests to validate correct functionality. - - -### Test Coverage - -This repository uses [Istanbul](https://github.com/gotwarlost/istanbul) as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory: - -``` bash -$ make test-cov -``` - -Istanbul creates a `./reports/coverage` directory. To access an HTML version of the report, - -``` bash -$ make view-cov -``` - - ---- -## License - -[MIT license](http://opensource.org/licenses/MIT). - - -## Copyright - -Copyright © 2014-2015. The [Compute.io](https://github.com/compute-io) Authors. - -[npm-image]: http://img.shields.io/npm/v/compute-dims.svg -[npm-url]: https://npmjs.org/package/compute-dims - -[travis-image]: http://img.shields.io/travis/compute-io/dims/master.svg -[travis-url]: https://travis-ci.org/compute-io/dims - -[coveralls-image]: https://img.shields.io/coveralls/compute-io/dims/master.svg -[coveralls-url]: https://coveralls.io/r/compute-io/dims?branch=master - -[dependencies-image]: http://img.shields.io/david/compute-io/dims.svg -[dependencies-url]: https://david-dm.org/compute-io/dims - -[dev-dependencies-image]: http://img.shields.io/david/dev/compute-io/dims.svg -[dev-dependencies-url]: https://david-dm.org/dev/compute-io/dims - -[github-issues-image]: http://img.shields.io/github/issues/compute-io/dims.svg -[github-issues-url]: https://github.com/compute-io/dims/issues diff --git a/server/node_modules/compute-dims/lib/index.js b/server/node_modules/compute-dims/lib/index.js deleted file mode 100644 index 646e06d..0000000 --- a/server/node_modules/compute-dims/lib/index.js +++ /dev/null @@ -1,114 +0,0 @@ -'use strict'; - -// MODULES // - -var isPositiveInteger = require( 'validate.io-positive-integer' ), - isArray = require( 'validate.io-array' ), - ndarrayLike = require( 'validate.io-ndarray-like' ), - createCopy = require( 'utils-copy' ); - - -// DIMS // - -/** -* FUNCTION: dims( x, d, max ) -* Computes array dimensions. -* -* @private -* @param {Array} arr - input array -* @param {Array} d - dimensions array -* @param {Number} max - max number of dimensions -* @returns {Array} dimensions array -*/ -function dims( arr, d, max ) { - if ( max && d.length === max ) { - return; - } - if ( !isArray( arr[0] ) ) { - return; - } - d.push( arr[0].length ); - dims( arr[ 0 ], d, max ); -} // end FUNCTION dims() - -/** -* FUNCTION: check( arr, d ) -* Checks that all array elements have the same dimensions. -* -* @private -* @param {Array} arr - input array -* @param {Array} d - dimensions array -* @returns {Boolean} boolean indicating if all array elements have the same dimensions -*/ -function check( arr, d ) { - var len = arr.length, - dim = d.shift(), - nDims = d.length, - val, - flg; - - for ( var i = 0; i < len; i++ ) { - val = arr[ i ]; - if ( !isArray( val ) || val.length !== dim ) { - return false; - } - if ( nDims ) { - flg = check( val, d.slice() ); - if ( !flg ) { - return false; - } - } - } - return true; -} // end FUNCTION check() - -/** -* FUNCTION: compute( x[, max] ) -* Computes dimensions. -* -* @param {Array} x - input object -* @param {Number} [max] - limits the number of dimensions returned -* @returns {Array|null} array of dimensions or null -*/ -function compute( x, max ) { - - var d, flg; - - if ( arguments.length > 1 ) { - if ( !isPositiveInteger( max ) ) { - throw new TypeError( 'dims()::invalid input argument. `max` option must be a positive integer.' ); - } - } - - if ( ndarrayLike( x ) === true ) { - d = createCopy( x.shape ); - if ( max && max <= d.length ) { - d.length = max; - } - return d; - } - - if ( isArray( x ) ) { - // [0] Initialize the dimensions array: - d = [ x.length ]; - - // [1] Recursively determine array dimensions: - dims( x, d, max ); - - // [2] Check that all array element dimensions are consistent... - if ( d.length > 1 ) { - flg = check( x, d.slice( 1 ) ); - if ( !flg ) { - return null; - } - } - return d; - } - - throw new TypeError( 'dims()::invalid input argument. Must provide an array, matrix or ndarray.' ); -} // end FUNCTION compute() - - -// EXPORTS // - -module.exports = compute; diff --git a/server/node_modules/compute-dims/package.json b/server/node_modules/compute-dims/package.json deleted file mode 100644 index 5e19705..0000000 --- a/server/node_modules/compute-dims/package.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "_from": "compute-dims@^1.1.0", - "_id": "compute-dims@1.1.0", - "_inBundle": false, - "_integrity": "sha512-YHMiIKjH/8Eom8zATk3g8/lH3HxGCZcVQyEfEoVrfWI7od/WRpTgRGShnei3jArYSx77mQqPxZNokjGHCdLfxg==", - "_location": "/compute-dims", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "compute-dims@^1.1.0", - "name": "compute-dims", - "escapedName": "compute-dims", - "rawSpec": "^1.1.0", - "saveSpec": null, - "fetchSpec": "^1.1.0" - }, - "_requiredBy": [ - "/pxls" - ], - "_resolved": "https://registry.npmjs.org/compute-dims/-/compute-dims-1.1.0.tgz", - "_shasum": "6d5b712929b6c531af3b4d580ed5adacbbd77e0c", - "_spec": "compute-dims@^1.1.0", - "_where": "/home/sigonasr2/divar/server/node_modules/pxls", - "author": { - "name": "Athan Reines", - "email": "kgryte@gmail.com" - }, - "bugs": { - "url": "https://github.com/compute-io/dims/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Athan Reines", - "email": "kgryte@gmail.com" - } - ], - "dependencies": { - "utils-copy": "^1.0.0", - "validate.io-array": "^1.0.6", - "validate.io-matrix-like": "^1.0.2", - "validate.io-ndarray-like": "^1.0.0", - "validate.io-positive-integer": "^1.0.0" - }, - "deprecated": false, - "description": "Computes array dimensions.", - "devDependencies": { - "chai": "3.x.x", - "coveralls": "^2.11.1", - "dstructs-matrix": "^2.0.0", - "istanbul": "^0.3.0", - "jshint": "2.x.x", - "jshint-stylish": "2.x.x", - "mocha": "2.x.x" - }, - "homepage": "https://github.com/compute-io/dims#readme", - "keywords": [ - "compute.io", - "compute", - "computation", - "array", - "utilities", - "utils", - "dimensions", - "size", - "shape", - "dims" - ], - "license": "MIT", - "main": "./lib", - "name": "compute-dims", - "repository": { - "type": "git", - "url": "git://github.com/compute-io/dims.git" - }, - "scripts": { - "coveralls": "istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coveralls/coverage --report lcovonly -- -R spec && cat ./reports/coveralls/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./reports/coveralls", - "test": "mocha", - "test-cov": "istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coverage -- -R spec" - }, - "version": "1.1.0" -} diff --git a/server/node_modules/const-max-uint32/LICENSE b/server/node_modules/const-max-uint32/LICENSE deleted file mode 100644 index 993d355..0000000 --- a/server/node_modules/const-max-uint32/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015-2016 The Compute.io Authors. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/server/node_modules/const-max-uint32/README.md b/server/node_modules/const-max-uint32/README.md deleted file mode 100644 index b906002..0000000 --- a/server/node_modules/const-max-uint32/README.md +++ /dev/null @@ -1,130 +0,0 @@ -Max Uint32 -=== -[![NPM version][npm-image]][npm-url] [![Build Status][build-image]][build-url] [![Coverage Status][coverage-image]][coverage-url] [![Dependencies][dependencies-image]][dependencies-url] - -> Maximum unsigned 32-bit integer. - - -## Installation - -``` bash -$ npm install const-max-uint32 -``` - - -## Usage - -``` javascript -var MAX_UINT32 = require( 'const-max-uint32' ); -``` - -#### MAX_UINT32 - -Maximum unsigned 32-bit `integer`. - -``` javascript -MAX_UINT32 === Math.pow( 2, 32 ) - 1; -``` - - -## Notes - -- `MAX_UINT32` is the maximum `array` length. - - -## Examples - -``` javascript -var MAX_UINT32 = require( 'const-max-uint32' ); - -console.log( MAX_UINT32 ); -// returns 4294967295 -``` - -To run the example code from the top-level application directory, - -``` bash -$ node ./examples/index.js -``` - - ---- -## Tests - -### Unit - -This repository uses [tape][tape] for unit tests. To run the tests, execute the following command in the top-level application directory: - -``` bash -$ make test -``` - -All new feature development should have corresponding unit tests to validate correct functionality. - - -### Test Coverage - -This repository uses [Istanbul][istanbul] as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory: - -``` bash -$ make test-cov -``` - -Istanbul creates a `./reports/coverage` directory. To access an HTML version of the report, - -``` bash -$ make view-cov -``` - - -### Browser Support - -This repository uses [Testling][testling] for browser testing. To run the tests in a (headless) local web browser, execute the following command in the top-level application directory: - -``` bash -$ make test-browsers -``` - -To view the tests in a local web browser, - -``` bash -$ make view-browser-tests -``` - - - - ---- -## License - -[MIT license](http://opensource.org/licenses/MIT). - - -## Copyright - -Copyright © 2015-2016. The [Compute.io][compute-io] Authors. - - -[npm-image]: http://img.shields.io/npm/v/const-max-uint32.svg -[npm-url]: https://npmjs.org/package/const-max-uint32 - -[build-image]: http://img.shields.io/travis/const-io/max-uint32/master.svg -[build-url]: https://travis-ci.org/const-io/max-uint32 - -[coverage-image]: https://img.shields.io/codecov/c/github/const-io/max-uint32/master.svg -[coverage-url]: https://codecov.io/github/const-io/max-uint32?branch=master - -[dependencies-image]: http://img.shields.io/david/const-io/max-uint32.svg -[dependencies-url]: https://david-dm.org/const-io/max-uint32 - -[dev-dependencies-image]: http://img.shields.io/david/dev/const-io/max-uint32.svg -[dev-dependencies-url]: https://david-dm.org/dev/const-io/max-uint32 - -[github-issues-image]: http://img.shields.io/github/issues/const-io/max-uint32.svg -[github-issues-url]: https://github.com/const-io/max-uint32/issues - -[tape]: https://github.com/substack/tape -[istanbul]: https://github.com/gotwarlost/istanbul -[testling]: https://ci.testling.com - -[compute-io]: https://github.com/compute-io \ No newline at end of file diff --git a/server/node_modules/const-max-uint32/lib/index.js b/server/node_modules/const-max-uint32/lib/index.js deleted file mode 100644 index 68cae7b..0000000 --- a/server/node_modules/const-max-uint32/lib/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -// EXPORTS // - -module.exports = 4294967295; // 2**32 - 1 diff --git a/server/node_modules/const-max-uint32/package.json b/server/node_modules/const-max-uint32/package.json deleted file mode 100644 index b3056b8..0000000 --- a/server/node_modules/const-max-uint32/package.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "_from": "const-max-uint32@^1.0.2", - "_id": "const-max-uint32@1.0.2", - "_inBundle": false, - "_integrity": "sha1-8Am7YjDmeO2HTdLWqc2ePL+rtnY=", - "_location": "/const-max-uint32", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "const-max-uint32@^1.0.2", - "name": "const-max-uint32", - "escapedName": "const-max-uint32", - "rawSpec": "^1.0.2", - "saveSpec": null, - "fetchSpec": "^1.0.2" - }, - "_requiredBy": [ - "/validate.io-array-like" - ], - "_resolved": "https://registry.npmjs.org/const-max-uint32/-/const-max-uint32-1.0.2.tgz", - "_shasum": "f009bb6230e678ed874dd2d6a9cd9e3cbfabb676", - "_spec": "const-max-uint32@^1.0.2", - "_where": "/home/sigonasr2/divar/server/node_modules/validate.io-array-like", - "author": { - "name": "Athan Reines", - "email": "kgryte@gmail.com" - }, - "bugs": { - "url": "https://github.com/const-io/max-uint32/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Athan Reines", - "email": "kgryte@gmail.com" - } - ], - "dependencies": {}, - "deprecated": false, - "description": "Maximum unsigned 32-bit integer.", - "devDependencies": { - "browserify": "12.x.x", - "codecov": "1.x.x", - "istanbul": "^0.4.1", - "jshint": "2.x.x", - "jshint-stylish": "2.x.x", - "math-power": "^1.0.0", - "tap-spec": "4.x.x", - "tape": "4.x.x", - "testling": "1.x.x" - }, - "homepage": "https://github.com/const-io/max-uint32#readme", - "keywords": [ - "compute.io", - "compute", - "computation", - "max", - "array", - "length", - "uint32", - "integer", - "unsigned", - "32-bit", - "const", - "const-io", - "const.io", - "constant" - ], - "license": "MIT", - "main": "./lib", - "name": "const-max-uint32", - "repository": { - "type": "git", - "url": "git://github.com/const-io/max-uint32.git" - }, - "scripts": { - "coverage": "istanbul cover --dir ./reports/codecov/coverage --report lcovonly tape -- \"./test/*.js\" && cat ./reports/codecov/coverage/lcov.info | codecov && rm -rf ./reports/codecov", - "test": "if [ \"${TRAVIS}\" ]; then npm run test-ci; else npm run test-local; fi", - "test-browsers": "browserify ./test/*.js | testling | tap-spec", - "test-ci": "npm run test-local && xvfb-run npm run test-browsers", - "test-cov": "istanbul cover --dir ./reports/coverage --report lcov tape -- \"./test/*.js\"", - "test-local": "tape \"./test/*.js\" | tap-spec" - }, - "testling": { - "files": [ - "test/*.js" - ], - "browsers": [ - "iexplore/6.0..latest", - "firefox/3.0..latest", - "firefox/nightly", - "chrome/4.0..latest", - "chrome/canary", - "opera/10.0..latest", - "opera/next", - "safari/4.0..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - }, - "version": "1.0.2" -} diff --git a/server/node_modules/const-pinf-float64/LICENSE b/server/node_modules/const-pinf-float64/LICENSE deleted file mode 100644 index e264f6d..0000000 --- a/server/node_modules/const-pinf-float64/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 The Compute.io Authors. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/server/node_modules/const-pinf-float64/README.md b/server/node_modules/const-pinf-float64/README.md deleted file mode 100644 index 5dc1c38..0000000 --- a/server/node_modules/const-pinf-float64/README.md +++ /dev/null @@ -1,124 +0,0 @@ -Positive Infinity -=== -[![NPM version][npm-image]][npm-url] [![Build Status][build-image]][build-url] [![Coverage Status][coverage-image]][coverage-url] [![Dependencies][dependencies-image]][dependencies-url] - -> Positive infinity. - - -## Installation - -``` bash -$ npm install const-pinf-float64 -``` - - -## Usage - -``` javascript -var pinf = require( 'const-pinf-float64' ); -``` - -#### pinf - -Positive infinity. - -``` javascript -pinf === Number.POSITIVE_INFINITY; -``` - - -## Examples - -``` javascript -var pinf = require( 'const-pinf-float64' ); - -console.log( pinf ); -``` - -To run the example code from the top-level application directory, - -``` bash -$ node ./examples/index.js -``` - - ---- -## Tests - -### Unit - -This repository uses [tape][tape] for unit tests. To run the tests, execute the following command in the top-level application directory: - -``` bash -$ make test -``` - -All new feature development should have corresponding unit tests to validate correct functionality. - - -### Test Coverage - -This repository uses [Istanbul][istanbul] as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory: - -``` bash -$ make test-cov -``` - -Istanbul creates a `./reports/coverage` directory. To access an HTML version of the report, - -``` bash -$ make view-cov -``` - - -### Browser Support - -This repository uses [Testling][testling] for browser testing. To run the tests in a (headless) local web browser, execute the following command in the top-level application directory: - -``` bash -$ make test-browsers -``` - -To view the tests in a local web browser, - -``` bash -$ make view-browser-tests -``` - - - - ---- -## License - -[MIT license](http://opensource.org/licenses/MIT). - - -## Copyright - -Copyright © 2016. The [Compute.io][compute-io] Authors.. - - -[npm-image]: http://img.shields.io/npm/v/const-pinf-float64.svg -[npm-url]: https://npmjs.org/package/const-pinf-float64 - -[build-image]: http://img.shields.io/travis/const-io/pinf-float64/master.svg -[build-url]: https://travis-ci.org/const-io/pinf-float64 - -[coverage-image]: https://img.shields.io/codecov/c/github/const-io/pinf-float64/master.svg -[coverage-url]: https://codecov.io/github/const-io/pinf-float64?branch=master - -[dependencies-image]: http://img.shields.io/david/const-io/pinf-float64.svg -[dependencies-url]: https://david-dm.org/const-io/pinf-float64 - -[dev-dependencies-image]: http://img.shields.io/david/dev/const-io/pinf-float64.svg -[dev-dependencies-url]: https://david-dm.org/dev/const-io/pinf-float64 - -[github-issues-image]: http://img.shields.io/github/issues/const-io/pinf-float64.svg -[github-issues-url]: https://github.com/const-io/pinf-float64/issues - -[tape]: https://github.com/substack/tape -[istanbul]: https://github.com/gotwarlost/istanbul -[testling]: https://ci.testling.com - -[compute-io]: https://github.com/compute-io/ diff --git a/server/node_modules/const-pinf-float64/lib/index.js b/server/node_modules/const-pinf-float64/lib/index.js deleted file mode 100644 index 2c6b0ae..0000000 --- a/server/node_modules/const-pinf-float64/lib/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -// EXPORTS // - -module.exports = Number.POSITIVE_INFINITY; diff --git a/server/node_modules/const-pinf-float64/package.json b/server/node_modules/const-pinf-float64/package.json deleted file mode 100644 index 9f17bee..0000000 --- a/server/node_modules/const-pinf-float64/package.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "_from": "const-pinf-float64@^1.0.0", - "_id": "const-pinf-float64@1.0.0", - "_inBundle": false, - "_integrity": "sha1-9u+w15+cCYbT558pI6v5twtj1yY=", - "_location": "/const-pinf-float64", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "const-pinf-float64@^1.0.0", - "name": "const-pinf-float64", - "escapedName": "const-pinf-float64", - "rawSpec": "^1.0.0", - "saveSpec": null, - "fetchSpec": "^1.0.0" - }, - "_requiredBy": [ - "/utils-copy" - ], - "_resolved": "https://registry.npmjs.org/const-pinf-float64/-/const-pinf-float64-1.0.0.tgz", - "_shasum": "f6efb0d79f9c0986d3e79f2923abf9b70b63d726", - "_spec": "const-pinf-float64@^1.0.0", - "_where": "/home/sigonasr2/divar/server/node_modules/utils-copy", - "author": { - "name": "Athan Reines", - "email": "kgryte@gmail.com" - }, - "bugs": { - "url": "https://github.com/const-io/pinf-float64/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Athan Reines", - "email": "kgryte@gmail.com" - } - ], - "dependencies": {}, - "deprecated": false, - "description": "Positive infinity.", - "devDependencies": { - "browserify": "12.x.x", - "codecov": "1.x.x", - "istanbul": "^0.4.1", - "jshint": "2.x.x", - "jshint-stylish": "2.x.x", - "tap-spec": "4.x.x", - "tape": "4.x.x", - "testling": "1.x.x" - }, - "homepage": "https://github.com/const-io/pinf-float64#readme", - "keywords": [ - "const.io", - "const", - "constant", - "const-io", - "compute.io", - "compute-io", - "computation", - "compute", - "mathematics", - "math", - "pinf", - "positive", - "infinity" - ], - "license": "MIT", - "main": "./lib", - "name": "const-pinf-float64", - "repository": { - "type": "git", - "url": "git://github.com/const-io/pinf-float64.git" - }, - "scripts": { - "coverage": "istanbul cover --dir ./reports/codecov/coverage --report lcovonly tape -- \"./test/*.js\" && cat ./reports/codecov/coverage/lcov.info | codecov && rm -rf ./reports/codecov", - "test": "if [ \"${TRAVIS}\" ]; then npm run test-ci; else npm run test-local; fi", - "test-browsers": "browserify ./test/*.js | testling | tap-spec", - "test-ci": "npm run test-local && xvfb-run npm run test-browsers", - "test-cov": "istanbul cover --dir ./reports/coverage --report lcov tape -- \"./test/*.js\"", - "test-local": "tape \"./test/*.js\" | tap-spec" - }, - "testling": { - "files": [ - "test/*.js" - ], - "browsers": [ - "iexplore/6.0..latest", - "firefox/3.0..latest", - "firefox/nightly", - "chrome/4.0..latest", - "chrome/canary", - "opera/10.0..latest", - "opera/next", - "safari/4.0..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - }, - "version": "1.0.0" -} diff --git a/server/node_modules/crypto/README.md b/server/node_modules/crypto/README.md deleted file mode 100644 index 5437f14..0000000 --- a/server/node_modules/crypto/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Deprecated Package - -This package is no longer supported and has been deprecated. To avoid malicious use, npm is hanging on to the package name. - -It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in. - -Please contact support@npmjs.com if you have questions about this package. diff --git a/server/node_modules/crypto/package.json b/server/node_modules/crypto/package.json deleted file mode 100644 index a643171..0000000 --- a/server/node_modules/crypto/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "_from": "crypto", - "_id": "crypto@1.0.1", - "_inBundle": false, - "_integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==", - "_location": "/crypto", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "crypto", - "name": "crypto", - "escapedName": "crypto", - "rawSpec": "", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz", - "_shasum": "2af1b7cad8175d24c8a1b0778255794a21803037", - "_spec": "crypto", - "_where": "/home/sigonasr2/divar/server", - "author": "", - "bugs": { - "url": "https://github.com/npm/deprecate-holder/issues" - }, - "bundleDependencies": false, - "deprecated": "This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.", - "description": "This package is no longer supported and has been deprecated. To avoid malicious use, npm is hanging on to the package name.", - "homepage": "https://github.com/npm/deprecate-holder#readme", - "license": "ISC", - "main": "index.js", - "name": "crypto", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/deprecate-holder.git" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "version": "1.0.1" -} diff --git a/server/node_modules/cwise-compiler/.npmignore b/server/node_modules/cwise-compiler/.npmignore deleted file mode 100644 index 038e024..0000000 --- a/server/node_modules/cwise-compiler/.npmignore +++ /dev/null @@ -1,16 +0,0 @@ -lib-cov -*.seed -*.log -*.csv -*.dat -*.out -*.pid -*.gz - -pids -logs -results - -npm-debug.log -node_modules/* -test/* \ No newline at end of file diff --git a/server/node_modules/cwise-compiler/.travis.yml b/server/node_modules/cwise-compiler/.travis.yml deleted file mode 100644 index 9672e12..0000000 --- a/server/node_modules/cwise-compiler/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" -before_install: - - npm install -g npm@~1.4.6 diff --git a/server/node_modules/cwise-compiler/LICENSE b/server/node_modules/cwise-compiler/LICENSE deleted file mode 100644 index 8ce206a..0000000 --- a/server/node_modules/cwise-compiler/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ - -The MIT License (MIT) - -Copyright (c) 2013 Mikola Lysenko - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/server/node_modules/cwise-compiler/README.md b/server/node_modules/cwise-compiler/README.md deleted file mode 100644 index ae19364..0000000 --- a/server/node_modules/cwise-compiler/README.md +++ /dev/null @@ -1,25 +0,0 @@ -cwise-compiler -============== -Just the compiler from cwise. You can call this directly if you know what you are doing and want to skip calling cwise-parser and including esprima. This is only recommended in extreme cases though. Otherwise you should stick to the default interface in cwise and not mess around with this craziness. - -[![build status](https://secure.travis-ci.org/scijs/cwise-compiler.png)](http://travis-ci.org/scijs/cwise-compiler) - -# Install -Install using [npm](https://www.npmjs.com/): - - npm install cwise-compiler - -# API -#### `require("cwise-compiler")(procedure)` -Compiles a cwise procedure for the given procedure. The object procedure must have the following fields: - -* `args` An array of argument types (as in cwise) -* `pre` A parsed pre function -* `body` A parsed body function -* `post` A parsed post function -* `funcName` Name of the function -* `blockSize` Block size to generate -* `debug` Debug mode flag - -# License -(c) 2013 Mikola Lysenko. MIT License diff --git a/server/node_modules/cwise-compiler/compiler.js b/server/node_modules/cwise-compiler/compiler.js deleted file mode 100644 index d2c8927..0000000 --- a/server/node_modules/cwise-compiler/compiler.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict" - -var createThunk = require("./lib/thunk.js") - -function Procedure() { - this.argTypes = [] - this.shimArgs = [] - this.arrayArgs = [] - this.arrayBlockIndices = [] - this.scalarArgs = [] - this.offsetArgs = [] - this.offsetArgIndex = [] - this.indexArgs = [] - this.shapeArgs = [] - this.funcName = "" - this.pre = null - this.body = null - this.post = null - this.debug = false -} - -function compileCwise(user_args) { - //Create procedure - var proc = new Procedure() - - //Parse blocks - proc.pre = user_args.pre - proc.body = user_args.body - proc.post = user_args.post - - //Parse arguments - var proc_args = user_args.args.slice(0) - proc.argTypes = proc_args - for(var i=0; i0) { - throw new Error("cwise: pre() block may not reference array args") - } - if(i < proc.post.args.length && proc.post.args[i].count>0) { - throw new Error("cwise: post() block may not reference array args") - } - } else if(arg_type === "scalar") { - proc.scalarArgs.push(i) - proc.shimArgs.push("scalar" + i) - } else if(arg_type === "index") { - proc.indexArgs.push(i) - if(i < proc.pre.args.length && proc.pre.args[i].count > 0) { - throw new Error("cwise: pre() block may not reference array index") - } - if(i < proc.body.args.length && proc.body.args[i].lvalue) { - throw new Error("cwise: body() block may not write to array index") - } - if(i < proc.post.args.length && proc.post.args[i].count > 0) { - throw new Error("cwise: post() block may not reference array index") - } - } else if(arg_type === "shape") { - proc.shapeArgs.push(i) - if(i < proc.pre.args.length && proc.pre.args[i].lvalue) { - throw new Error("cwise: pre() block may not write to array shape") - } - if(i < proc.body.args.length && proc.body.args[i].lvalue) { - throw new Error("cwise: body() block may not write to array shape") - } - if(i < proc.post.args.length && proc.post.args[i].lvalue) { - throw new Error("cwise: post() block may not write to array shape") - } - } else if(typeof arg_type === "object" && arg_type.offset) { - proc.argTypes[i] = "offset" - proc.offsetArgs.push({ array: arg_type.array, offset:arg_type.offset }) - proc.offsetArgIndex.push(i) - } else { - throw new Error("cwise: Unknown argument type " + proc_args[i]) - } - } - - //Make sure at least one array argument was specified - if(proc.arrayArgs.length <= 0) { - throw new Error("cwise: No array arguments specified") - } - - //Make sure arguments are correct - if(proc.pre.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in pre() block") - } - if(proc.body.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in body() block") - } - if(proc.post.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in post() block") - } - - //Check debug flag - proc.debug = !!user_args.printCode || !!user_args.debug - - //Retrieve name - proc.funcName = user_args.funcName || "cwise" - - //Read in block size - proc.blockSize = user_args.blockSize || 64 - - return createThunk(proc) -} - -module.exports = compileCwise diff --git a/server/node_modules/cwise-compiler/lib/compile.js b/server/node_modules/cwise-compiler/lib/compile.js deleted file mode 100644 index 87910e0..0000000 --- a/server/node_modules/cwise-compiler/lib/compile.js +++ /dev/null @@ -1,358 +0,0 @@ -"use strict" - -var uniq = require("uniq") - -// This function generates very simple loops analogous to how you typically traverse arrays (the outermost loop corresponds to the slowest changing index, the innermost loop to the fastest changing index) -// TODO: If two arrays have the same strides (and offsets) there is potential for decreasing the number of "pointers" and related variables. The drawback is that the type signature would become more specific and that there would thus be less potential for caching, but it might still be worth it, especially when dealing with large numbers of arguments. -function innerFill(order, proc, body) { - var dimension = order.length - , nargs = proc.arrayArgs.length - , has_index = proc.indexArgs.length>0 - , code = [] - , vars = [] - , idx=0, pidx=0, i, j - for(i=0; i 0) { - code.push("var " + vars.join(",")) - } - //Scan loop - for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards - idx = order[i] - code.push(["for(i",i,"=0;i",i," 0) { - code.push(["index[",pidx,"]-=s",pidx].join("")) - } - code.push(["++index[",idx,"]"].join("")) - } - code.push("}") - } - return code.join("\n") -} - -// Generate "outer" loops that loop over blocks of data, applying "inner" loops to the blocks by manipulating the local variables in such a way that the inner loop only "sees" the current block. -// TODO: If this is used, then the previous declaration (done by generateCwiseOp) of s* is essentially unnecessary. -// I believe the s* are not used elsewhere (in particular, I don't think they're used in the pre/post parts and "shape" is defined independently), so it would be possible to make defining the s* dependent on what loop method is being used. -function outerFill(matched, order, proc, body) { - var dimension = order.length - , nargs = proc.arrayArgs.length - , blockSize = proc.blockSize - , has_index = proc.indexArgs.length > 0 - , code = [] - for(var i=0; i0;){"].join("")) // Iterate back to front - code.push(["if(j",i,"<",blockSize,"){"].join("")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j). - code.push(["s",order[i],"=j",i].join("")) - code.push(["j",i,"=0"].join("")) - code.push(["}else{s",order[i],"=",blockSize].join("")) - code.push(["j",i,"-=",blockSize,"}"].join("")) - if(has_index) { - code.push(["index[",order[i],"]=j",i].join("")) - } - } - for(var i=0; i 0) { - allEqual = allEqual && summary[i] === summary[i-1] - } - } - if(allEqual) { - return summary[0] - } - return summary.join("") -} - -//Generates a cwise operator -function generateCWiseOp(proc, typesig) { - - //Compute dimension - // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg. - var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0 - var orders = new Array(proc.arrayArgs.length) - var dtypes = new Array(proc.arrayArgs.length) - for(var i=0; i 0) { - vars.push("shape=SS.slice(0)") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example) - } - if(proc.indexArgs.length > 0) { - // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes. - var zeros = new Array(dimension) - for(var i=0; i 0) { - code.push("var " + vars.join(",")) - } - for(var i=0; i 3) { - code.push(processBlock(proc.pre, proc, dtypes)) - } - - //Process body - var body = processBlock(proc.body, proc, dtypes) - var matched = countMatches(loopOrders) - if(matched < dimension) { - code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example. - } else { - code.push(innerFill(loopOrders[0], proc, body)) - } - - //Inline epilog - if(proc.post.body.length > 3) { - code.push(processBlock(proc.post, proc, dtypes)) - } - - if(proc.debug) { - console.log("-----Generated cwise routine for ", typesig, ":\n" + code.join("\n") + "\n----------") - } - - var loopName = [(proc.funcName||"unnamed"), "_cwise_loop_", orders[0].join("s"),"m",matched,typeSummary(dtypes)].join("") - var f = new Function(["function ",loopName,"(", arglist.join(","),"){", code.join("\n"),"} return ", loopName].join("")) - return f() -} -module.exports = generateCWiseOp diff --git a/server/node_modules/cwise-compiler/lib/thunk.js b/server/node_modules/cwise-compiler/lib/thunk.js deleted file mode 100644 index 728954f..0000000 --- a/server/node_modules/cwise-compiler/lib/thunk.js +++ /dev/null @@ -1,86 +0,0 @@ -"use strict" - -// The function below is called when constructing a cwise function object, and does the following: -// A function object is constructed which accepts as argument a compilation function and returns another function. -// It is this other function that is eventually returned by createThunk, and this function is the one that actually -// checks whether a certain pattern of arguments has already been used before and compiles new loops as needed. -// The compilation passed to the first function object is used for compiling new functions. -// Once this function object is created, it is called with compile as argument, where the first argument of compile -// is bound to "proc" (essentially containing a preprocessed version of the user arguments to cwise). -// So createThunk roughly works like this: -// function createThunk(proc) { -// var thunk = function(compileBound) { -// var CACHED = {} -// return function(arrays and scalars) { -// if (dtype and order of arrays in CACHED) { -// var func = CACHED[dtype and order of arrays] -// } else { -// var func = CACHED[dtype and order of arrays] = compileBound(dtype and order of arrays) -// } -// return func(arrays and scalars) -// } -// } -// return thunk(compile.bind1(proc)) -// } - -var compile = require("./compile.js") - -function createThunk(proc) { - var code = ["'use strict'", "var CACHED={}"] - var vars = [] - var thunkName = proc.funcName + "_cwise_thunk" - - //Build thunk - code.push(["return function ", thunkName, "(", proc.shimArgs.join(","), "){"].join("")) - var typesig = [] - var string_typesig = [] - var proc_args = [["array",proc.arrayArgs[0],".shape.slice(", // Slice shape so that we only retain the shape over which we iterate (which gets passed to the cwise operator as SS). - Math.max(0,proc.arrayBlockIndices[0]),proc.arrayBlockIndices[0]<0?(","+proc.arrayBlockIndices[0]+")"):")"].join("")] - var shapeLengthConditions = [], shapeConditions = [] - // Process array arguments - for(var i=0; i0) { // Gather conditions to check for shape equality (ignoring block indices) - shapeLengthConditions.push("array" + proc.arrayArgs[0] + ".shape.length===array" + j + ".shape.length+" + (Math.abs(proc.arrayBlockIndices[0])-Math.abs(proc.arrayBlockIndices[i]))) - shapeConditions.push("array" + proc.arrayArgs[0] + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[0]) + "]===array" + j + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[i]) + "]") - } - } - // Check for shape equality - if (proc.arrayArgs.length > 1) { - code.push("if (!(" + shapeLengthConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same dimensionality!')") - code.push("for(var shapeIndex=array" + proc.arrayArgs[0] + ".shape.length-" + Math.abs(proc.arrayBlockIndices[0]) + "; shapeIndex-->0;) {") - code.push("if (!(" + shapeConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same shape!')") - code.push("}") - } - // Process scalar arguments - for(var i=0; i'+ - 'Embedded Window'+ - '

42

'+ - ''; - - // Escape the HTML for URL formatting - var uri = 'data:text/html;charset=utf-8,' + encodeURIComponent(html); - - var buf = dataUriToBuffer(uri); - assert.equal('text/html', buf.type); - assert.equal('utf-8', buf.charset); - assert.equal(html, buf.toString()); - }); - - // the next 4 tests are from: - // https://bug161965.bugzilla.mozilla.org/attachment.cgi?id=94670&action=view - - it('should decode "ISO-8859-8 in Base64" URIs', function () { - var uri = 'data:text/plain;charset=iso-8859-8-i;base64,+ezl7Q=='; - - var buf = dataUriToBuffer(uri); - assert.equal('text/plain', buf.type); - assert.equal('iso-8859-8-i', buf.charset); - assert.equal(4, buf.length); - assert.equal(0xf9, buf[0]); - assert.equal(0xec, buf[1]); - assert.equal(0xe5, buf[2]); - assert.equal(0xed, buf[3]); - }); - - it('should decode "ISO-8859-8 in URL-encoding" URIs', function () { - var uri = 'data:text/plain;charset=iso-8859-8-i,%f9%ec%e5%ed'; - - var buf = dataUriToBuffer(uri); - assert.equal('text/plain', buf.type); - assert.equal('iso-8859-8-i', buf.charset); - assert.equal(4, buf.length); - assert.equal(0xf9, buf[0]); - assert.equal(0xec, buf[1]); - assert.equal(0xe5, buf[2]); - assert.equal(0xed, buf[3]); - }); - - it('should decode "UTF-8 in Base64" URIs', function () { - var uri = 'data:text/plain;charset=UTF-8;base64,16nXnNeV150='; - - var buf = dataUriToBuffer(uri); - assert.equal('text/plain', buf.type); - assert.equal('UTF-8', buf.charset); - assert.equal(8, buf.length); - assert.equal('שלום', buf.toString('utf8')); - }); - - it('should decode "UTF-8 in URL-encoding" URIs', function () { - var uri = 'data:text/plain;charset=UTF-8,%d7%a9%d7%9c%d7%95%d7%9d'; - - var buf = dataUriToBuffer(uri); - assert.equal('text/plain', buf.type); - assert.equal('UTF-8', buf.charset); - assert.equal(8, buf.length); - assert.equal('שלום', buf.toString('utf8')); - }); - - // this next one is from Wikipedia IIRC - - it('should decode "base64" Data URIs with newlines', function () { - var uri = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA\n' + - 'AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO\n' + - '9TXL0Y4OHwAAAABJRU5ErkJggg=='; - - var buf = dataUriToBuffer(uri); - assert.equal('image/png', buf.type); - assert.equal('iVBORw0KGgoAAAANSUhEUgAAAAUA' + - 'AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO' + - '9TXL0Y4OHwAAAABJRU5ErkJggg==', buf.toString('base64')); - }); - - it('should decode a plain-text URI with a space character in it', function () { - var uri = 'data:,foo bar'; - - var buf = dataUriToBuffer(uri); - assert.equal('text/plain', buf.type); - assert.equal('foo bar', buf.toString()); - }); - - it('should take "data" segment after the first comma', function () { - var uri = 'data:,a,b'; - var buf = dataUriToBuffer(uri); - assert.equal('text/plain', buf.type); - assert.equal('a,b', buf.toString()); - }); - -}); diff --git a/server/node_modules/dtype/.npmignore b/server/node_modules/dtype/.npmignore deleted file mode 100644 index 2ccbe46..0000000 --- a/server/node_modules/dtype/.npmignore +++ /dev/null @@ -1 +0,0 @@ -/node_modules/ diff --git a/server/node_modules/dtype/README.md b/server/node_modules/dtype/README.md deleted file mode 100644 index 3af7156..0000000 --- a/server/node_modules/dtype/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# dtype - -Return a data type from a string representing the data type. - -Mostly useful for using with [ndarray](https://github.com/mikolalysenko/ndarray) -where you would like instantiate a typed array of the same `array.dtype`. - -See [ndarray-dtype](https://www.npmjs.com/package/ndarray-dtype) if you need to support Buffer and other ndarray types. - -## example - -```js -var dtype = require('dtype') -var ndarray = require('ndarray') - -var arr = ndarray(new Int8Array(32)) - -// some time later - -var newarr = ndarray(new (dtype(arr.dtype))) -``` - -## API -`dtype(string)` will return the following data types based on the strings given: - -Data type | String ---------: | :----- -`Int8Array` | "int8" -`Int16Array` | "int16" -`Int32Array` | "int32" -`Uint8Array` | "uint8" -`Uint16Array` | "uint16" -`Uint32Array` | "uint32" -`Float32Array` | "float32" -`Float64Array` | "float64" -`Array` | "array" -`Uint8ClampedArray` | "uint8_clamped" - -Returns `undefined` if the type isn't recognized. - -## install - -With [npm](https://npmjs.org) do: - -``` -npm install dtype -``` - -Use [browserify](http://browserify.org) to `require('dtype')`. - -## see also - -- [ndarray-dtype](https://www.npmjs.com/package/ndarray-dtype) - -## release history -* 2.0.0 - moving buffer, generic and data to a different module -* 1.0.0 - Add uint8_clamped, generic, data, dataview and buffer types -* 0.1.0 - initial release - -## license -Copyright (c) 2015 Kyle Robinson Young
-Licensed under the MIT license. diff --git a/server/node_modules/dtype/index.js b/server/node_modules/dtype/index.js deleted file mode 100644 index ad02b3c..0000000 --- a/server/node_modules/dtype/index.js +++ /dev/null @@ -1,24 +0,0 @@ -module.exports = function(dtype) { - switch (dtype) { - case 'int8': - return Int8Array - case 'int16': - return Int16Array - case 'int32': - return Int32Array - case 'uint8': - return Uint8Array - case 'uint16': - return Uint16Array - case 'uint32': - return Uint32Array - case 'float32': - return Float32Array - case 'float64': - return Float64Array - case 'array': - return Array - case 'uint8_clamped': - return Uint8ClampedArray - } -} diff --git a/server/node_modules/dtype/package.json b/server/node_modules/dtype/package.json deleted file mode 100644 index ea8c815..0000000 --- a/server/node_modules/dtype/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "_from": "dtype@^2.0.0", - "_id": "dtype@2.0.0", - "_inBundle": false, - "_integrity": "sha1-zQUjI84GFETs0uj1dI9popvihDQ=", - "_location": "/dtype", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "dtype@^2.0.0", - "name": "dtype", - "escapedName": "dtype", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/flatten-vertex-data" - ], - "_resolved": "https://registry.npmjs.org/dtype/-/dtype-2.0.0.tgz", - "_shasum": "cd052323ce061444ecd2e8f5748f69a29be28434", - "_spec": "dtype@^2.0.0", - "_where": "/home/sigonasr2/divar/server/node_modules/flatten-vertex-data", - "author": { - "name": "Kyle Robinson Young", - "email": "kyle@dontkry.com", - "url": "http://dontkry.com" - }, - "bugs": { - "url": "https://github.com/shama/dtype/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Return a data type from a string representing the type", - "devDependencies": { - "tape": "^4.0.0" - }, - "engines": { - "node": ">= 0.8.0" - }, - "homepage": "https://github.com/shama/dtype", - "keywords": [ - "ndarray", - "array", - "typed" - ], - "license": "MIT", - "name": "dtype", - "repository": { - "type": "git", - "url": "git://github.com/shama/dtype.git" - }, - "scripts": { - "test": "node test.js" - }, - "version": "2.0.0" -} diff --git a/server/node_modules/dtype/test.js b/server/node_modules/dtype/test.js deleted file mode 100644 index 94d21f8..0000000 --- a/server/node_modules/dtype/test.js +++ /dev/null @@ -1,27 +0,0 @@ -var test = require('tape') -var dtype = require('./') - -test('dtype', function(t) { - t.plan(11) - var arr = new (dtype('int8')) - t.ok(arr instanceof Int8Array) - arr = new (dtype('int16')) - t.ok(arr instanceof Int16Array) - arr = new (dtype('int32')) - t.ok(arr instanceof Int32Array) - arr = new (dtype('uint8')) - t.ok(arr instanceof Uint8Array) - arr = new (dtype('uint16')) - t.ok(arr instanceof Uint16Array) - arr = new (dtype('uint32')) - t.ok(arr instanceof Uint32Array) - arr = new (dtype('float32')) - t.ok(arr instanceof Float32Array) - arr = new (dtype('float64')) - t.ok(arr instanceof Float64Array) - arr = new (dtype('array')) - t.ok(arr instanceof Array) - arr = new (dtype('uint8_clamped')) - t.ok(arr instanceof Uint8ClampedArray) - t.equal(dtype('buffer'), undefined, 'returns undefined for non-array types') -}) diff --git a/server/node_modules/file-type/index.d.ts b/server/node_modules/file-type/index.d.ts deleted file mode 100644 index c7b6c2b..0000000 --- a/server/node_modules/file-type/index.d.ts +++ /dev/null @@ -1,191 +0,0 @@ -/// -import {Readable as ReadableStream} from 'stream'; - -declare namespace fileType { - type FileType = - | 'jpg' - | 'png' - | 'gif' - | 'webp' - | 'flif' - | 'cr2' - | 'tif' - | 'bmp' - | 'jxr' - | 'psd' - | 'zip' - | 'tar' - | 'rar' - | 'gz' - | 'bz2' - | '7z' - | 'dmg' - | 'mp4' - | 'm4v' - | 'mid' - | 'mkv' - | 'webm' - | 'mov' - | 'avi' - | 'wmv' - | 'mpg' - | 'mp2' - | 'mp3' - | 'm4a' - | 'ogg' - | 'opus' - | 'flac' - | 'wav' - | 'qcp' - | 'amr' - | 'pdf' - | 'epub' - | 'mobi' - | 'exe' - | 'swf' - | 'rtf' - | 'woff' - | 'woff2' - | 'eot' - | 'ttf' - | 'otf' - | 'ico' - | 'flv' - | 'ps' - | 'xz' - | 'sqlite' - | 'nes' - | 'crx' - | 'xpi' - | 'cab' - | 'deb' - | 'ar' - | 'rpm' - | 'Z' - | 'lz' - | 'msi' - | 'mxf' - | 'mts' - | 'wasm' - | 'blend' - | 'bpg' - | 'docx' - | 'pptx' - | 'xlsx' - | '3gp' - | 'jp2' - | 'jpm' - | 'jpx' - | 'mj2' - | 'aif' - | 'odt' - | 'ods' - | 'odp' - | 'xml' - | 'heic' - | 'cur' - | 'ktx' - | 'ape' - | 'wv' - | 'asf' - | 'wma' - | 'wmv' - | 'dcm' - | 'mpc' - | 'ics' - | 'glb' - | 'pcap'; - - interface FileTypeResult { - /** - One of the supported [file types](https://github.com/sindresorhus/file-type#supported-file-types). - */ - ext: FileType; - - /** - The detected [MIME type](https://en.wikipedia.org/wiki/Internet_media_type). - */ - mime: string; - } - - type ReadableStreamWithFileType = ReadableStream & { - readonly fileType: FileTypeResult | null; - }; -} - -declare const fileType: { - /** - Detect the file type of a `Buffer`/`Uint8Array`/`ArrayBuffer`. The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. - - @param buffer - It only needs the first `.minimumBytes` bytes. The exception is detection of `docx`, `pptx`, and `xlsx` which potentially requires reading the whole file. - @returns An object with the detected file type and MIME type or `null` when there was no match. - - @example - ``` - import readChunk = require('read-chunk'); - import fileType = require('file-type'); - - const buffer = readChunk.sync('unicorn.png', 0, fileType.minimumBytes); - - fileType(buffer); - //=> {ext: 'png', mime: 'image/png'} - - - // Or from a remote location: - - import * as http from 'http'; - - const url = 'https://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif'; - - http.get(url, response => { - response.on('readable', () => { - const chunk = response.read(fileType.minimumBytes); - response.destroy(); - console.log(fileType(chunk)); - //=> {ext: 'gif', mime: 'image/gif'} - }); - }); - ``` - */ - (buffer: Buffer | Uint8Array | ArrayBuffer): fileType.FileTypeResult | null; - - /** - The minimum amount of bytes needed to detect a file type. Currently, it's 4100 bytes, but it can change, so don't hard-code it. - */ - readonly minimumBytes: number; - - /** - Detect the file type of a readable stream. - - @param readableStream - A readable stream containing a file to examine, see: [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable). - @returns A `Promise` which resolves to the original readable stream argument, but with an added `fileType` property, which is an object like the one returned from `fileType()`. - - @example - ``` - import * as fs from 'fs'; - import * as crypto from 'crypto'; - import fileType = require('file-type'); - - (async () => { - const read = fs.createReadStream('encrypted.enc'); - const decipher = crypto.createDecipheriv(alg, key, iv); - - const stream = await fileType.stream(read.pipe(decipher)); - - console.log(stream.fileType); - //=> {ext: 'mov', mime: 'video/quicktime'} - - const write = fs.createWriteStream(`decrypted.${stream.fileType.ext}`); - stream.pipe(write); - })(); - ``` - */ - readonly stream: ( - readableStream: ReadableStream - ) => Promise; - - // TODO: Remove this for the next major release - readonly default: typeof fileType; -}; - -export = fileType; diff --git a/server/node_modules/file-type/index.js b/server/node_modules/file-type/index.js deleted file mode 100644 index cf744b3..0000000 --- a/server/node_modules/file-type/index.js +++ /dev/null @@ -1,953 +0,0 @@ -'use strict'; -const toBytes = s => [...s].map(c => c.charCodeAt(0)); -const xpiZipFilename = toBytes('META-INF/mozilla.rsa'); -const oxmlContentTypes = toBytes('[Content_Types].xml'); -const oxmlRels = toBytes('_rels/.rels'); - -function readUInt64LE(buf, offset = 0) { - let n = buf[offset]; - let mul = 1; - let i = 0; - while (++i < 8) { - mul *= 0x100; - n += buf[offset + i] * mul; - } - - return n; -} - -const fileType = input => { - if (!(input instanceof Uint8Array || input instanceof ArrayBuffer || Buffer.isBuffer(input))) { - throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof input}\``); - } - - const buf = input instanceof Uint8Array ? input : new Uint8Array(input); - - if (!(buf && buf.length > 1)) { - return null; - } - - const check = (header, options) => { - options = Object.assign({ - offset: 0 - }, options); - - for (let i = 0; i < header.length; i++) { - // If a bitmask is set - if (options.mask) { - // If header doesn't equal `buf` with bits masked off - if (header[i] !== (options.mask[i] & buf[i + options.offset])) { - return false; - } - } else if (header[i] !== buf[i + options.offset]) { - return false; - } - } - - return true; - }; - - const checkString = (header, options) => check(toBytes(header), options); - - if (check([0xFF, 0xD8, 0xFF])) { - return { - ext: 'jpg', - mime: 'image/jpeg' - }; - } - - if (check([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])) { - return { - ext: 'png', - mime: 'image/png' - }; - } - - if (check([0x47, 0x49, 0x46])) { - return { - ext: 'gif', - mime: 'image/gif' - }; - } - - if (check([0x57, 0x45, 0x42, 0x50], {offset: 8})) { - return { - ext: 'webp', - mime: 'image/webp' - }; - } - - if (check([0x46, 0x4C, 0x49, 0x46])) { - return { - ext: 'flif', - mime: 'image/flif' - }; - } - - // Needs to be before `tif` check - if ( - (check([0x49, 0x49, 0x2A, 0x0]) || check([0x4D, 0x4D, 0x0, 0x2A])) && - check([0x43, 0x52], {offset: 8}) - ) { - return { - ext: 'cr2', - mime: 'image/x-canon-cr2' - }; - } - - if ( - check([0x49, 0x49, 0x2A, 0x0]) || - check([0x4D, 0x4D, 0x0, 0x2A]) - ) { - return { - ext: 'tif', - mime: 'image/tiff' - }; - } - - if (check([0x42, 0x4D])) { - return { - ext: 'bmp', - mime: 'image/bmp' - }; - } - - if (check([0x49, 0x49, 0xBC])) { - return { - ext: 'jxr', - mime: 'image/vnd.ms-photo' - }; - } - - if (check([0x38, 0x42, 0x50, 0x53])) { - return { - ext: 'psd', - mime: 'image/vnd.adobe.photoshop' - }; - } - - // Zip-based file formats - // Need to be before the `zip` check - if (check([0x50, 0x4B, 0x3, 0x4])) { - if ( - check([0x6D, 0x69, 0x6D, 0x65, 0x74, 0x79, 0x70, 0x65, 0x61, 0x70, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2F, 0x65, 0x70, 0x75, 0x62, 0x2B, 0x7A, 0x69, 0x70], {offset: 30}) - ) { - return { - ext: 'epub', - mime: 'application/epub+zip' - }; - } - - // Assumes signed `.xpi` from addons.mozilla.org - if (check(xpiZipFilename, {offset: 30})) { - return { - ext: 'xpi', - mime: 'application/x-xpinstall' - }; - } - - if (checkString('mimetypeapplication/vnd.oasis.opendocument.text', {offset: 30})) { - return { - ext: 'odt', - mime: 'application/vnd.oasis.opendocument.text' - }; - } - - if (checkString('mimetypeapplication/vnd.oasis.opendocument.spreadsheet', {offset: 30})) { - return { - ext: 'ods', - mime: 'application/vnd.oasis.opendocument.spreadsheet' - }; - } - - if (checkString('mimetypeapplication/vnd.oasis.opendocument.presentation', {offset: 30})) { - return { - ext: 'odp', - mime: 'application/vnd.oasis.opendocument.presentation' - }; - } - - // The docx, xlsx and pptx file types extend the Office Open XML file format: - // https://en.wikipedia.org/wiki/Office_Open_XML_file_formats - // We look for: - // - one entry named '[Content_Types].xml' or '_rels/.rels', - // - one entry indicating specific type of file. - // MS Office, OpenOffice and LibreOffice may put the parts in different order, so the check should not rely on it. - const findNextZipHeaderIndex = (arr, startAt = 0) => arr.findIndex((el, i, arr) => i >= startAt && arr[i] === 0x50 && arr[i + 1] === 0x4B && arr[i + 2] === 0x3 && arr[i + 3] === 0x4); - - let zipHeaderIndex = 0; // The first zip header was already found at index 0 - let oxmlFound = false; - let type = null; - - do { - const offset = zipHeaderIndex + 30; - - if (!oxmlFound) { - oxmlFound = (check(oxmlContentTypes, {offset}) || check(oxmlRels, {offset})); - } - - if (!type) { - if (checkString('word/', {offset})) { - type = { - ext: 'docx', - mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' - }; - } else if (checkString('ppt/', {offset})) { - type = { - ext: 'pptx', - mime: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' - }; - } else if (checkString('xl/', {offset})) { - type = { - ext: 'xlsx', - mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' - }; - } - } - - if (oxmlFound && type) { - return type; - } - - zipHeaderIndex = findNextZipHeaderIndex(buf, offset); - } while (zipHeaderIndex >= 0); - - // No more zip parts available in the buffer, but maybe we are almost certain about the type? - if (type) { - return type; - } - } - - if ( - check([0x50, 0x4B]) && - (buf[2] === 0x3 || buf[2] === 0x5 || buf[2] === 0x7) && - (buf[3] === 0x4 || buf[3] === 0x6 || buf[3] === 0x8) - ) { - return { - ext: 'zip', - mime: 'application/zip' - }; - } - - if (check([0x75, 0x73, 0x74, 0x61, 0x72], {offset: 257})) { - return { - ext: 'tar', - mime: 'application/x-tar' - }; - } - - if ( - check([0x52, 0x61, 0x72, 0x21, 0x1A, 0x7]) && - (buf[6] === 0x0 || buf[6] === 0x1) - ) { - return { - ext: 'rar', - mime: 'application/x-rar-compressed' - }; - } - - if (check([0x1F, 0x8B, 0x8])) { - return { - ext: 'gz', - mime: 'application/gzip' - }; - } - - if (check([0x42, 0x5A, 0x68])) { - return { - ext: 'bz2', - mime: 'application/x-bzip2' - }; - } - - if (check([0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C])) { - return { - ext: '7z', - mime: 'application/x-7z-compressed' - }; - } - - if (check([0x78, 0x01])) { - return { - ext: 'dmg', - mime: 'application/x-apple-diskimage' - }; - } - - if (check([0x33, 0x67, 0x70, 0x35]) || // 3gp5 - ( - check([0x0, 0x0, 0x0]) && check([0x66, 0x74, 0x79, 0x70], {offset: 4}) && - ( - check([0x6D, 0x70, 0x34, 0x31], {offset: 8}) || // MP41 - check([0x6D, 0x70, 0x34, 0x32], {offset: 8}) || // MP42 - check([0x69, 0x73, 0x6F, 0x6D], {offset: 8}) || // ISOM - check([0x69, 0x73, 0x6F, 0x32], {offset: 8}) || // ISO2 - check([0x6D, 0x6D, 0x70, 0x34], {offset: 8}) || // MMP4 - check([0x4D, 0x34, 0x56], {offset: 8}) || // M4V - check([0x64, 0x61, 0x73, 0x68], {offset: 8}) // DASH - ) - )) { - return { - ext: 'mp4', - mime: 'video/mp4' - }; - } - - if (check([0x4D, 0x54, 0x68, 0x64])) { - return { - ext: 'mid', - mime: 'audio/midi' - }; - } - - // https://github.com/threatstack/libmagic/blob/master/magic/Magdir/matroska - if (check([0x1A, 0x45, 0xDF, 0xA3])) { - const sliced = buf.subarray(4, 4 + 4096); - const idPos = sliced.findIndex((el, i, arr) => arr[i] === 0x42 && arr[i + 1] === 0x82); - - if (idPos !== -1) { - const docTypePos = idPos + 3; - const findDocType = type => [...type].every((c, i) => sliced[docTypePos + i] === c.charCodeAt(0)); - - if (findDocType('matroska')) { - return { - ext: 'mkv', - mime: 'video/x-matroska' - }; - } - - if (findDocType('webm')) { - return { - ext: 'webm', - mime: 'video/webm' - }; - } - } - } - - if (check([0x0, 0x0, 0x0, 0x14, 0x66, 0x74, 0x79, 0x70, 0x71, 0x74, 0x20, 0x20]) || - check([0x66, 0x72, 0x65, 0x65], {offset: 4}) || // Type: `free` - check([0x66, 0x74, 0x79, 0x70, 0x71, 0x74, 0x20, 0x20], {offset: 4}) || - check([0x6D, 0x64, 0x61, 0x74], {offset: 4}) || // MJPEG - check([0x6D, 0x6F, 0x6F, 0x76], {offset: 4}) || // Type: `moov` - check([0x77, 0x69, 0x64, 0x65], {offset: 4})) { - return { - ext: 'mov', - mime: 'video/quicktime' - }; - } - - // RIFF file format which might be AVI, WAV, QCP, etc - if (check([0x52, 0x49, 0x46, 0x46])) { - if (check([0x41, 0x56, 0x49], {offset: 8})) { - return { - ext: 'avi', - mime: 'video/vnd.avi' - }; - } - - if (check([0x57, 0x41, 0x56, 0x45], {offset: 8})) { - return { - ext: 'wav', - mime: 'audio/vnd.wave' - }; - } - - // QLCM, QCP file - if (check([0x51, 0x4C, 0x43, 0x4D], {offset: 8})) { - return { - ext: 'qcp', - mime: 'audio/qcelp' - }; - } - } - - // ASF_Header_Object first 80 bytes - if (check([0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9])) { - // Search for header should be in first 1KB of file. - - let offset = 30; - do { - const objectSize = readUInt64LE(buf, offset + 16); - if (check([0x91, 0x07, 0xDC, 0xB7, 0xB7, 0xA9, 0xCF, 0x11, 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65], {offset})) { - // Sync on Stream-Properties-Object (B7DC0791-A9B7-11CF-8EE6-00C00C205365) - if (check([0x40, 0x9E, 0x69, 0xF8, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B], {offset: offset + 24})) { - // Found audio: - return { - ext: 'wma', - mime: 'audio/x-ms-wma' - }; - } - - if (check([0xC0, 0xEF, 0x19, 0xBC, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B], {offset: offset + 24})) { - // Found video: - return { - ext: 'wmv', - mime: 'video/x-ms-asf' - }; - } - - break; - } - - offset += objectSize; - } while (offset + 24 <= buf.length); - - // Default to ASF generic extension - return { - ext: 'asf', - mime: 'application/vnd.ms-asf' - }; - } - - if ( - check([0x0, 0x0, 0x1, 0xBA]) || - check([0x0, 0x0, 0x1, 0xB3]) - ) { - return { - ext: 'mpg', - mime: 'video/mpeg' - }; - } - - if (check([0x66, 0x74, 0x79, 0x70, 0x33, 0x67], {offset: 4})) { - return { - ext: '3gp', - mime: 'video/3gpp' - }; - } - - // Check for MPEG header at different starting offsets - for (let start = 0; start < 2 && start < (buf.length - 16); start++) { - if ( - check([0x49, 0x44, 0x33], {offset: start}) || // ID3 header - check([0xFF, 0xE2], {offset: start, mask: [0xFF, 0xE2]}) // MPEG 1 or 2 Layer 3 header - ) { - return { - ext: 'mp3', - mime: 'audio/mpeg' - }; - } - - if ( - check([0xFF, 0xE4], {offset: start, mask: [0xFF, 0xE4]}) // MPEG 1 or 2 Layer 2 header - ) { - return { - ext: 'mp2', - mime: 'audio/mpeg' - }; - } - - if ( - check([0xFF, 0xF8], {offset: start, mask: [0xFF, 0xFC]}) // MPEG 2 layer 0 using ADTS - ) { - return { - ext: 'mp2', - mime: 'audio/mpeg' - }; - } - - if ( - check([0xFF, 0xF0], {offset: start, mask: [0xFF, 0xFC]}) // MPEG 4 layer 0 using ADTS - ) { - return { - ext: 'mp4', - mime: 'audio/mpeg' - }; - } - } - - if ( - check([0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41], {offset: 4}) - ) { - return { // MPEG-4 layer 3 (audio) - ext: 'm4a', - mime: 'audio/mp4' // RFC 4337 - }; - } - - // Needs to be before `ogg` check - if (check([0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64], {offset: 28})) { - return { - ext: 'opus', - mime: 'audio/opus' - }; - } - - // If 'OggS' in first bytes, then OGG container - if (check([0x4F, 0x67, 0x67, 0x53])) { - // This is a OGG container - - // If ' theora' in header. - if (check([0x80, 0x74, 0x68, 0x65, 0x6F, 0x72, 0x61], {offset: 28})) { - return { - ext: 'ogv', - mime: 'video/ogg' - }; - } - - // If '\x01video' in header. - if (check([0x01, 0x76, 0x69, 0x64, 0x65, 0x6F, 0x00], {offset: 28})) { - return { - ext: 'ogm', - mime: 'video/ogg' - }; - } - - // If ' FLAC' in header https://xiph.org/flac/faq.html - if (check([0x7F, 0x46, 0x4C, 0x41, 0x43], {offset: 28})) { - return { - ext: 'oga', - mime: 'audio/ogg' - }; - } - - // 'Speex ' in header https://en.wikipedia.org/wiki/Speex - if (check([0x53, 0x70, 0x65, 0x65, 0x78, 0x20, 0x20], {offset: 28})) { - return { - ext: 'spx', - mime: 'audio/ogg' - }; - } - - // If '\x01vorbis' in header - if (check([0x01, 0x76, 0x6F, 0x72, 0x62, 0x69, 0x73], {offset: 28})) { - return { - ext: 'ogg', - mime: 'audio/ogg' - }; - } - - // Default OGG container https://www.iana.org/assignments/media-types/application/ogg - return { - ext: 'ogx', - mime: 'application/ogg' - }; - } - - if (check([0x66, 0x4C, 0x61, 0x43])) { - return { - ext: 'flac', - mime: 'audio/x-flac' - }; - } - - if (check([0x4D, 0x41, 0x43, 0x20])) { // 'MAC ' - return { - ext: 'ape', - mime: 'audio/ape' - }; - } - - if (check([0x77, 0x76, 0x70, 0x6B])) { // 'wvpk' - return { - ext: 'wv', - mime: 'audio/wavpack' - }; - } - - if (check([0x23, 0x21, 0x41, 0x4D, 0x52, 0x0A])) { - return { - ext: 'amr', - mime: 'audio/amr' - }; - } - - if (check([0x25, 0x50, 0x44, 0x46])) { - return { - ext: 'pdf', - mime: 'application/pdf' - }; - } - - if (check([0x4D, 0x5A])) { - return { - ext: 'exe', - mime: 'application/x-msdownload' - }; - } - - if ( - (buf[0] === 0x43 || buf[0] === 0x46) && - check([0x57, 0x53], {offset: 1}) - ) { - return { - ext: 'swf', - mime: 'application/x-shockwave-flash' - }; - } - - if (check([0x7B, 0x5C, 0x72, 0x74, 0x66])) { - return { - ext: 'rtf', - mime: 'application/rtf' - }; - } - - if (check([0x00, 0x61, 0x73, 0x6D])) { - return { - ext: 'wasm', - mime: 'application/wasm' - }; - } - - if ( - check([0x77, 0x4F, 0x46, 0x46]) && - ( - check([0x00, 0x01, 0x00, 0x00], {offset: 4}) || - check([0x4F, 0x54, 0x54, 0x4F], {offset: 4}) - ) - ) { - return { - ext: 'woff', - mime: 'font/woff' - }; - } - - if ( - check([0x77, 0x4F, 0x46, 0x32]) && - ( - check([0x00, 0x01, 0x00, 0x00], {offset: 4}) || - check([0x4F, 0x54, 0x54, 0x4F], {offset: 4}) - ) - ) { - return { - ext: 'woff2', - mime: 'font/woff2' - }; - } - - if ( - check([0x4C, 0x50], {offset: 34}) && - ( - check([0x00, 0x00, 0x01], {offset: 8}) || - check([0x01, 0x00, 0x02], {offset: 8}) || - check([0x02, 0x00, 0x02], {offset: 8}) - ) - ) { - return { - ext: 'eot', - mime: 'application/vnd.ms-fontobject' - }; - } - - if (check([0x00, 0x01, 0x00, 0x00, 0x00])) { - return { - ext: 'ttf', - mime: 'font/ttf' - }; - } - - if (check([0x4F, 0x54, 0x54, 0x4F, 0x00])) { - return { - ext: 'otf', - mime: 'font/otf' - }; - } - - if (check([0x00, 0x00, 0x01, 0x00])) { - return { - ext: 'ico', - mime: 'image/x-icon' - }; - } - - if (check([0x00, 0x00, 0x02, 0x00])) { - return { - ext: 'cur', - mime: 'image/x-icon' - }; - } - - if (check([0x46, 0x4C, 0x56, 0x01])) { - return { - ext: 'flv', - mime: 'video/x-flv' - }; - } - - if (check([0x25, 0x21])) { - return { - ext: 'ps', - mime: 'application/postscript' - }; - } - - if (check([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00])) { - return { - ext: 'xz', - mime: 'application/x-xz' - }; - } - - if (check([0x53, 0x51, 0x4C, 0x69])) { - return { - ext: 'sqlite', - mime: 'application/x-sqlite3' - }; - } - - if (check([0x4E, 0x45, 0x53, 0x1A])) { - return { - ext: 'nes', - mime: 'application/x-nintendo-nes-rom' - }; - } - - if (check([0x43, 0x72, 0x32, 0x34])) { - return { - ext: 'crx', - mime: 'application/x-google-chrome-extension' - }; - } - - if ( - check([0x4D, 0x53, 0x43, 0x46]) || - check([0x49, 0x53, 0x63, 0x28]) - ) { - return { - ext: 'cab', - mime: 'application/vnd.ms-cab-compressed' - }; - } - - // Needs to be before `ar` check - if (check([0x21, 0x3C, 0x61, 0x72, 0x63, 0x68, 0x3E, 0x0A, 0x64, 0x65, 0x62, 0x69, 0x61, 0x6E, 0x2D, 0x62, 0x69, 0x6E, 0x61, 0x72, 0x79])) { - return { - ext: 'deb', - mime: 'application/x-deb' - }; - } - - if (check([0x21, 0x3C, 0x61, 0x72, 0x63, 0x68, 0x3E])) { - return { - ext: 'ar', - mime: 'application/x-unix-archive' - }; - } - - if (check([0xED, 0xAB, 0xEE, 0xDB])) { - return { - ext: 'rpm', - mime: 'application/x-rpm' - }; - } - - if ( - check([0x1F, 0xA0]) || - check([0x1F, 0x9D]) - ) { - return { - ext: 'Z', - mime: 'application/x-compress' - }; - } - - if (check([0x4C, 0x5A, 0x49, 0x50])) { - return { - ext: 'lz', - mime: 'application/x-lzip' - }; - } - - if (check([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1])) { - return { - ext: 'msi', - mime: 'application/x-msi' - }; - } - - if (check([0x06, 0x0E, 0x2B, 0x34, 0x02, 0x05, 0x01, 0x01, 0x0D, 0x01, 0x02, 0x01, 0x01, 0x02])) { - return { - ext: 'mxf', - mime: 'application/mxf' - }; - } - - if (check([0x47], {offset: 4}) && (check([0x47], {offset: 192}) || check([0x47], {offset: 196}))) { - return { - ext: 'mts', - mime: 'video/mp2t' - }; - } - - if (check([0x42, 0x4C, 0x45, 0x4E, 0x44, 0x45, 0x52])) { - return { - ext: 'blend', - mime: 'application/x-blender' - }; - } - - if (check([0x42, 0x50, 0x47, 0xFB])) { - return { - ext: 'bpg', - mime: 'image/bpg' - }; - } - - if (check([0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A])) { - // JPEG-2000 family - - if (check([0x6A, 0x70, 0x32, 0x20], {offset: 20})) { - return { - ext: 'jp2', - mime: 'image/jp2' - }; - } - - if (check([0x6A, 0x70, 0x78, 0x20], {offset: 20})) { - return { - ext: 'jpx', - mime: 'image/jpx' - }; - } - - if (check([0x6A, 0x70, 0x6D, 0x20], {offset: 20})) { - return { - ext: 'jpm', - mime: 'image/jpm' - }; - } - - if (check([0x6D, 0x6A, 0x70, 0x32], {offset: 20})) { - return { - ext: 'mj2', - mime: 'image/mj2' - }; - } - } - - if (check([0x46, 0x4F, 0x52, 0x4D])) { - return { - ext: 'aif', - mime: 'audio/aiff' - }; - } - - if (checkString(' new Promise((resolve, reject) => { - // Using `eval` to work around issues when bundling with Webpack - const stream = eval('require')('stream'); // eslint-disable-line no-eval - - readableStream.once('readable', () => { - const pass = new stream.PassThrough(); - const chunk = readableStream.read(module.exports.minimumBytes) || readableStream.read(); - try { - pass.fileType = fileType(chunk); - } catch (error) { - reject(error); - } - - readableStream.unshift(chunk); - - if (stream.pipeline) { - resolve(stream.pipeline(readableStream, pass, () => {})); - } else { - resolve(readableStream.pipe(pass)); - } - }); -}); diff --git a/server/node_modules/file-type/license b/server/node_modules/file-type/license deleted file mode 100644 index e7af2f7..0000000 --- a/server/node_modules/file-type/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/file-type/package.json b/server/node_modules/file-type/package.json deleted file mode 100644 index 358656a..0000000 --- a/server/node_modules/file-type/package.json +++ /dev/null @@ -1,163 +0,0 @@ -{ - "_from": "file-type@^10.9.0", - "_id": "file-type@10.11.0", - "_inBundle": false, - "_integrity": "sha512-uzk64HRpUZyTGZtVuvrjP0FYxzQrBf4rojot6J65YMEbwBLB0CWm0CLojVpwpmFmxcE/lkvYICgfcGozbBq6rw==", - "_location": "/file-type", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "file-type@^10.9.0", - "name": "file-type", - "escapedName": "file-type", - "rawSpec": "^10.9.0", - "saveSpec": null, - "fetchSpec": "^10.9.0" - }, - "_requiredBy": [ - "/image-type" - ], - "_resolved": "https://registry.npmjs.org/file-type/-/file-type-10.11.0.tgz", - "_shasum": "2961d09e4675b9fb9a3ee6b69e9cd23f43fd1890", - "_spec": "file-type@^10.9.0", - "_where": "/home/sigonasr2/divar/server/node_modules/image-type", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/file-type/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Detect the file type of a Buffer/Uint8Array/ArrayBuffer", - "devDependencies": { - "@types/node": "^11.12.2", - "ava": "^1.4.1", - "pify": "^4.0.1", - "read-chunk": "^3.2.0", - "tsd": "^0.7.1", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=6" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/sindresorhus/file-type#readme", - "keywords": [ - "mime", - "file", - "type", - "archive", - "image", - "img", - "pic", - "picture", - "flash", - "photo", - "video", - "detect", - "check", - "is", - "exif", - "exe", - "binary", - "buffer", - "uint8array", - "jpg", - "png", - "gif", - "webp", - "flif", - "cr2", - "tif", - "bmp", - "jxr", - "psd", - "zip", - "tar", - "rar", - "gz", - "bz2", - "7z", - "dmg", - "mp4", - "m4v", - "mid", - "mkv", - "webm", - "mov", - "avi", - "mpg", - "mp2", - "mp3", - "m4a", - "ogg", - "opus", - "flac", - "wav", - "amr", - "pdf", - "epub", - "mobi", - "swf", - "rtf", - "woff", - "woff2", - "eot", - "ttf", - "otf", - "ico", - "flv", - "ps", - "xz", - "sqlite", - "xpi", - "cab", - "deb", - "ar", - "rpm", - "Z", - "lz", - "msi", - "mxf", - "mts", - "wasm", - "webassembly", - "blend", - "bpg", - "docx", - "pptx", - "xlsx", - "3gp", - "jp2", - "jpm", - "jpx", - "mj2", - "aif", - "odt", - "ods", - "odp", - "xml", - "heic", - "wma", - "ics", - "glb", - "pcap" - ], - "license": "MIT", - "name": "file-type", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/file-type.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "10.11.0" -} diff --git a/server/node_modules/file-type/readme.md b/server/node_modules/file-type/readme.md deleted file mode 100644 index ef989cb..0000000 --- a/server/node_modules/file-type/readme.md +++ /dev/null @@ -1,238 +0,0 @@ -# file-type [![Build Status](https://travis-ci.org/sindresorhus/file-type.svg?branch=master)](https://travis-ci.org/sindresorhus/file-type) - -> Detect the file type of a Buffer/Uint8Array/ArrayBuffer - -The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. - - -## Install - -``` -$ npm install file-type -``` - - - - - - -## Usage - -##### Node.js - -```js -const readChunk = require('read-chunk'); -const fileType = require('file-type'); - -const buffer = readChunk.sync('unicorn.png', 0, fileType.minimumBytes); - -fileType(buffer); -//=> {ext: 'png', mime: 'image/png'} -``` - -Or from a remote location: - -```js -const http = require('http'); -const fileType = require('file-type'); - -const url = 'https://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif'; - -http.get(url, response => { - response.on('readable', () => { - const chunk = response.read(fileType.minimumBytes); - response.destroy(); - console.log(fileType(chunk)); - //=> {ext: 'gif', mime: 'image/gif'} - }); -}); -``` - -Or from a stream: - -```js -const fs = require('fs'); -const crypto = require('crypto'); -const fileType = require('file-type'); - -(async () => { - const read = fs.createReadStream('encrypted.enc'); - const decipher = crypto.createDecipheriv(alg, key, iv); - - const stream = await fileType.stream(read.pipe(decipher)); - - console.log(stream.fileType); - //=> {ext: 'mov', mime: 'video/quicktime'} - - const write = fs.createWriteStream(`decrypted.${stream.fileType.ext}`); - stream.pipe(write); -})(); -``` - - -##### Browser - -```js -const xhr = new XMLHttpRequest(); -xhr.open('GET', 'unicorn.png'); -xhr.responseType = 'arraybuffer'; - -xhr.onload = () => { - fileType(new Uint8Array(this.response)); - //=> {ext: 'png', mime: 'image/png'} -}; - -xhr.send(); -``` - - -## API - -### fileType(input) - -Returns an `Object` with: - -- `ext` - One of the [supported file types](#supported-file-types) -- `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type) - -Or `null` when there is no match. - -#### input - -Type: `Buffer | Uint8Array | ArrayBuffer` - -It only needs the first `.minimumBytes` bytes. The exception is detection of `docx`, `pptx`, and `xlsx` which potentially requires reading the whole file. - -### fileType.minimumBytes - -Type: `number` - -The minimum amount of bytes needed to detect a file type. Currently, it's 4100 bytes, but it can change, so don't hardcode it. - -### fileType.stream(readableStream) - -Detect the file type of a readable stream. - -Returns a `Promise` which resolves to the original readable stream argument, but with an added `fileType` property, which is an object like the one returned from `fileType()`. - -*Note:* This method is only for Node.js. - -#### readableStream - -Type: [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable) - - -## Supported file types - -- [`jpg`](https://en.wikipedia.org/wiki/JPEG) -- [`png`](https://en.wikipedia.org/wiki/Portable_Network_Graphics) -- [`gif`](https://en.wikipedia.org/wiki/GIF) -- [`webp`](https://en.wikipedia.org/wiki/WebP) -- [`flif`](https://en.wikipedia.org/wiki/Free_Lossless_Image_Format) -- [`cr2`](https://fileinfo.com/extension/cr2) -- [`tif`](https://en.wikipedia.org/wiki/Tagged_Image_File_Format) -- [`bmp`](https://en.wikipedia.org/wiki/BMP_file_format) -- [`jxr`](https://en.wikipedia.org/wiki/JPEG_XR) -- [`psd`](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format) -- [`zip`](https://en.wikipedia.org/wiki/Zip_(file_format)) -- [`tar`](https://en.wikipedia.org/wiki/Tar_(computing)#File_format) -- [`rar`](https://en.wikipedia.org/wiki/RAR_(file_format)) -- [`gz`](https://en.wikipedia.org/wiki/Gzip) -- [`bz2`](https://en.wikipedia.org/wiki/Bzip2) -- [`7z`](https://en.wikipedia.org/wiki/7z) -- [`dmg`](https://en.wikipedia.org/wiki/Apple_Disk_Image) -- [`mp4`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions) -- [`m4v`](https://en.wikipedia.org/wiki/M4V) -- [`mid`](https://en.wikipedia.org/wiki/MIDI) -- [`mkv`](https://en.wikipedia.org/wiki/Matroska) -- [`webm`](https://en.wikipedia.org/wiki/WebM) -- [`mov`](https://en.wikipedia.org/wiki/QuickTime_File_Format) -- [`avi`](https://en.wikipedia.org/wiki/Audio_Video_Interleave) -- [`wmv`](https://en.wikipedia.org/wiki/Windows_Media_Video) -- [`mpg`](https://en.wikipedia.org/wiki/MPEG-1) -- [`mp2`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_II) -- [`mp3`](https://en.wikipedia.org/wiki/MP3) -- [`m4a`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#.MP4_versus_.M4A) -- [`ogg`](https://en.wikipedia.org/wiki/Ogg) -- [`opus`](https://en.wikipedia.org/wiki/Opus_(audio_format)) -- [`flac`](https://en.wikipedia.org/wiki/FLAC) -- [`wav`](https://en.wikipedia.org/wiki/WAV) -- [`qcp`](https://en.wikipedia.org/wiki/QCP) -- [`amr`](https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec) -- [`pdf`](https://en.wikipedia.org/wiki/Portable_Document_Format) -- [`epub`](https://en.wikipedia.org/wiki/EPUB) -- [`mobi`](https://en.wikipedia.org/wiki/Mobipocket) - Mobipocket -- [`exe`](https://en.wikipedia.org/wiki/.exe) -- [`swf`](https://en.wikipedia.org/wiki/SWF) -- [`rtf`](https://en.wikipedia.org/wiki/Rich_Text_Format) -- [`woff`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) -- [`woff2`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) -- [`eot`](https://en.wikipedia.org/wiki/Embedded_OpenType) -- [`ttf`](https://en.wikipedia.org/wiki/TrueType) -- [`otf`](https://en.wikipedia.org/wiki/OpenType) -- [`ico`](https://en.wikipedia.org/wiki/ICO_(file_format)) -- [`flv`](https://en.wikipedia.org/wiki/Flash_Video) -- [`ps`](https://en.wikipedia.org/wiki/Postscript) -- [`xz`](https://en.wikipedia.org/wiki/Xz) -- [`sqlite`](https://www.sqlite.org/fileformat2.html) -- [`nes`](https://fileinfo.com/extension/nes) -- [`crx`](https://developer.chrome.com/extensions/crx) -- [`xpi`](https://en.wikipedia.org/wiki/XPInstall) -- [`cab`](https://en.wikipedia.org/wiki/Cabinet_(file_format)) -- [`deb`](https://en.wikipedia.org/wiki/Deb_(file_format)) -- [`ar`](https://en.wikipedia.org/wiki/Ar_(Unix)) -- [`rpm`](https://fileinfo.com/extension/rpm) -- [`Z`](https://fileinfo.com/extension/z) -- [`lz`](https://en.wikipedia.org/wiki/Lzip) -- [`msi`](https://en.wikipedia.org/wiki/Windows_Installer) -- [`mxf`](https://en.wikipedia.org/wiki/Material_Exchange_Format) -- [`mts`](https://en.wikipedia.org/wiki/.m2ts) -- [`wasm`](https://en.wikipedia.org/wiki/WebAssembly) -- [`blend`](https://wiki.blender.org/index.php/Dev:Source/Architecture/File_Format) -- [`bpg`](https://bellard.org/bpg/) -- [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML) -- [`pptx`](https://en.wikipedia.org/wiki/Office_Open_XML) -- [`xlsx`](https://en.wikipedia.org/wiki/Office_Open_XML) -- [`3gp`](https://en.wikipedia.org/wiki/3GP_and_3G2) -- [`jp2`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 -- [`jpm`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 -- [`jpx`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 -- [`mj2`](https://en.wikipedia.org/wiki/Motion_JPEG_2000) - Motion JPEG 2000 -- [`aif`](https://en.wikipedia.org/wiki/Audio_Interchange_File_Format) -- [`odt`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for word processing -- [`ods`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for spreadsheets -- [`odp`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for presentations -- [`xml`](https://en.wikipedia.org/wiki/XML) -- [`heic`](https://nokiatech.github.io/heif/technical.html) -- [`cur`](https://en.wikipedia.org/wiki/ICO_(file_format)) -- [`ktx`](https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/) -- [`ape`](https://en.wikipedia.org/wiki/Monkey%27s_Audio) - Monkey's Audio -- [`wv`](https://en.wikipedia.org/wiki/WavPack) - WavPack -- [`asf`](https://en.wikipedia.org/wiki/Advanced_Systems_Format) - Advanced Systems Format -- [`wma`](https://en.wikipedia.org/wiki/Windows_Media_Audio) - Windows Media Audio -- [`wmv`](https://en.wikipedia.org/wiki/Windows_Media_Video) - Windows Media Video -- [`dcm`](https://en.wikipedia.org/wiki/DICOM#Data_format) - DICOM Image File -- [`mpc`](https://en.wikipedia.org/wiki/Musepack) - Musepack (SV7 & SV8) -- [`ics`](https://en.wikipedia.org/wiki/ICalendar#Data_format) - iCalendar -- [`glb`](https://github.com/KhronosGroup/glTF) - GL Transmission Format -- [`pcap`](https://wiki.wireshark.org/Development/LibpcapFileFormat) - Libpcap File Format - -*SVG isn't included as it requires the whole file to be read, but you can get it [here](https://github.com/sindresorhus/is-svg).* - -*Pull request welcome for additional commonly used file types.* - - -## Related - -- [file-type-cli](https://github.com/sindresorhus/file-type-cli) - CLI for this module - - -## Created by - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Mikael Finstad](https://github.com/mifi) - - -## License - -MIT diff --git a/server/node_modules/flatten-vertex-data/LICENSE.md b/server/node_modules/flatten-vertex-data/LICENSE.md deleted file mode 100644 index c8b72e1..0000000 --- a/server/node_modules/flatten-vertex-data/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) -Copyright (c) 2015 glo-js - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE -OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/server/node_modules/flatten-vertex-data/README.md b/server/node_modules/flatten-vertex-data/README.md deleted file mode 100644 index 643392f..0000000 --- a/server/node_modules/flatten-vertex-data/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# flatten-vertex-data - -[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges) - -Copies flat or nested array data into the specified typed array, or a new typed array. Intended to be used for WebGL buffers. If the input is nested array data, this guesses the dimensionality based on the length of the first sub-array. - -## Install - -```sh -npm install flatten-vertex-data --save -``` - -## Example - -Accepts a [dtype string](https://www.npmjs.com/package/dtype) (creating a new array) or an output typed array to re-use. Defaults to creating a new Float32Array. - -```js -var flatten = require('flatten-vertex-data') - -var positions = [ [x1, y1], [x2, y2], [x3, y3] ] - -flatten(positions) -//=> new Float32Array([ x1, y1, x2, y2, x3, y3 ]) - -flatten(positions, 'uint16') -//=> new Uint16Array([ x1, y1, x2, y2, x3, y3 ]) - -// flatten & copy positions into output -var output = new Uint16Array(positions.length * 2) -flatten(positions, output) -``` - -## Usage - -[![NPM](https://nodei.co/npm/flatten-vertex-data.png)](https://www.npmjs.com/package/flatten-vertex-data) - -#### `output = flatten(data, [output|type], [offset])` - -Copies flat or nested arrays into a typed array, where `data` can be: - -- a nested array like `[ [ x, y ], [ x, y ] ]` -- a flat array like `[ x, y, z, x, y, z ]` -- a typed array like `new Float32Array([ x, y ])` - -The second parameter can be a `type` string for [dtype](https://www.npmjs.com/package/dtype), which creates a new array. Or, it can be an existing typed array to re-use as the `output` destination. It defaults to `'float32'` (a new Float32Array). - -Returns the `output` typed array. - -The third parameter, `offset`, can be a number (default 0), the index in the destination array at which to start copying the `data`. If a new array is being created, its capacity will be expanded to fit `dataLength + offset` (i.e. it will have leading zeros). - -## License - -MIT, see [LICENSE.md](http://github.com/glo-js/flatten-vertex-data/blob/master/LICENSE.md) for details. diff --git a/server/node_modules/flatten-vertex-data/index.js b/server/node_modules/flatten-vertex-data/index.js deleted file mode 100644 index 0a627f0..0000000 --- a/server/node_modules/flatten-vertex-data/index.js +++ /dev/null @@ -1,58 +0,0 @@ -/*eslint new-cap:0*/ -var dtype = require('dtype') - -module.exports = flattenVertexData - -function flattenVertexData (data, output, offset) { - if (!data) throw new TypeError('must specify data as first parameter') - offset = +(offset || 0) | 0 - - if (Array.isArray(data) && (data[0] && typeof data[0][0] === 'number')) { - var dim = data[0].length - var length = data.length * dim - var i, j, k, l - - // no output specified, create a new typed array - if (!output || typeof output === 'string') { - output = new (dtype(output || 'float32'))(length + offset) - } - - var dstLength = output.length - offset - if (length !== dstLength) { - throw new Error('source length ' + length + ' (' + dim + 'x' + data.length + ')' + - ' does not match destination length ' + dstLength) - } - - for (i = 0, k = offset; i < data.length; i++) { - for (j = 0; j < dim; j++) { - output[k++] = data[i][j] === null ? NaN : data[i][j] - } - } - } else { - if (!output || typeof output === 'string') { - // no output, create a new one - var Ctor = dtype(output || 'float32') - - // handle arrays separately due to possible nulls - if (Array.isArray(data) || output === 'array') { - output = new Ctor(data.length + offset) - for (i = 0, k = offset, l = output.length; k < l; k++, i++) { - output[k] = data[i] === null ? NaN : data[i] - } - } else { - if (offset === 0) { - output = new Ctor(data) - } else { - output = new Ctor(data.length + offset) - - output.set(data, offset) - } - } - } else { - // store output in existing array - output.set(data, offset) - } - } - - return output -} diff --git a/server/node_modules/flatten-vertex-data/package.json b/server/node_modules/flatten-vertex-data/package.json deleted file mode 100644 index 1b1c8cb..0000000 --- a/server/node_modules/flatten-vertex-data/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "_from": "flatten-vertex-data@^1.0.2", - "_id": "flatten-vertex-data@1.0.2", - "_inBundle": false, - "_integrity": "sha512-BvCBFK2NZqerFTdMDgqfHBwxYWnxeCkwONsw6PvBMcUXqo8U/KDWwmXhqx1x2kLIg7DqIsJfOaJFOmlua3Lxuw==", - "_location": "/flatten-vertex-data", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "flatten-vertex-data@^1.0.2", - "name": "flatten-vertex-data", - "escapedName": "flatten-vertex-data", - "rawSpec": "^1.0.2", - "saveSpec": null, - "fetchSpec": "^1.0.2" - }, - "_requiredBy": [ - "/to-array-buffer" - ], - "_resolved": "https://registry.npmjs.org/flatten-vertex-data/-/flatten-vertex-data-1.0.2.tgz", - "_shasum": "889fd60bea506006ca33955ee1105175fb620219", - "_spec": "flatten-vertex-data@^1.0.2", - "_where": "/home/sigonasr2/divar/server/node_modules/to-array-buffer", - "author": { - "name": "Matt DesLauriers", - "email": "dave.des@gmail.com", - "url": "https://github.com/mattdesl" - }, - "bugs": { - "url": "https://github.com/glo-js/flatten-vertex-data/issues" - }, - "bundleDependencies": false, - "dependencies": { - "dtype": "^2.0.0" - }, - "deprecated": false, - "description": "flattens nested vertex data into a typed array", - "devDependencies": { - "faucet": "0.0.1", - "standard": "^5.3.1", - "tape": "^4.9.0" - }, - "homepage": "https://github.com/glo-js/flatten-vertex-data", - "keywords": [ - "dtype", - "flat", - "flatten", - "pack", - "array", - "type", - "typed", - "typedarray", - "vert", - "vertex", - "webgl", - "gl", - "glsl", - "shader", - "buffer" - ], - "license": "MIT", - "main": "index.js", - "name": "flatten-vertex-data", - "repository": { - "type": "git", - "url": "git://github.com/glo-js/flatten-vertex-data.git" - }, - "scripts": { - "test": "standard && node test.js | faucet" - }, - "version": "1.0.2" -} diff --git a/server/node_modules/flip-pixels/.eslintrc.json b/server/node_modules/flip-pixels/.eslintrc.json deleted file mode 100644 index 1e5e08b..0000000 --- a/server/node_modules/flip-pixels/.eslintrc.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "env": { - "browser": true, - "node": true, - "commonjs": true, - "es6": true - }, - "extends": "eslint:recommended", - "rules": { - "strict": 2, - "indent": 0, - "linebreak-style": 0, - "quotes": 0, - "semi": 0, - "no-cond-assign": 1, - "no-constant-condition": 1, - "no-duplicate-case": 1, - "no-empty": 1, - "no-ex-assign": 1, - "no-extra-boolean-cast": 1, - "no-extra-semi": 1, - "no-fallthrough": 1, - "no-func-assign": 1, - "no-global-assign": 1, - "no-implicit-globals": 2, - "no-inner-declarations": ["error", "functions"], - "no-irregular-whitespace": 2, - "no-loop-func": 1, - "no-magic-numbers": ["warn", { "ignore": [1, 0, -1], "ignoreArrayIndexes": true}], - "no-multi-str": 1, - "no-mixed-spaces-and-tabs": 1, - "no-proto": 1, - "no-sequences": 1, - "no-throw-literal": 1, - "no-unmodified-loop-condition": 1, - "no-useless-call": 1, - "no-void": 1, - "no-with": 2, - "wrap-iife": 1, - "no-redeclare": 1, - "no-unused-vars": ["error", { "vars": "all", "args": "none" }], - "no-sparse-arrays": 1 - } -} diff --git a/server/node_modules/flip-pixels/.travis.yml b/server/node_modules/flip-pixels/.travis.yml deleted file mode 100644 index 2c956da..0000000 --- a/server/node_modules/flip-pixels/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -sudo: false -language: node_js -node_js: - - "6" - - "5" - - "4" - - "0.12" - - "0.10" -matrix: - fast_finish: true - allow_failures: - - node_js: "0.10" - - node_js: "0.12" diff --git a/server/node_modules/flip-pixels/index.js b/server/node_modules/flip-pixels/index.js deleted file mode 100644 index 7951cc6..0000000 --- a/server/node_modules/flip-pixels/index.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict' - -module.exports = function flip (pixels, w, h, c) { - // handle Arrays - if (Array.isArray(pixels)) { - var result = flip(new Float64Array(pixels), w, h, c) - for (var i = 0; i < pixels.length; i++) { - pixels[i] = result[i] - } - return pixels - } - - if (!w || !h) throw Error('Bad dimensions') - if (!c) c = pixels.length / (w * h) - - var h2 = h >> 1 - var row = w * c - var Ctor = pixels.constructor - - - // make a temp buffer to hold one row - var temp = new Ctor(w * c) - for (var y = 0; y < h2; ++y) { - var topOffset = y * row - var bottomOffset = (h - y - 1) * row - - // make copy of a row on the top half - temp.set(pixels.subarray(topOffset, topOffset + row)) - - // copy a row from the bottom half to the top - pixels.copyWithin(topOffset, bottomOffset, bottomOffset + row) - - // copy the copy of the top half row to the bottom half - pixels.set(temp, bottomOffset) - } - - return pixels -} diff --git a/server/node_modules/flip-pixels/package.json b/server/node_modules/flip-pixels/package.json deleted file mode 100644 index c9abd89..0000000 --- a/server/node_modules/flip-pixels/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "_from": "flip-pixels@^1.0.1", - "_id": "flip-pixels@1.0.2", - "_inBundle": false, - "_integrity": "sha512-oXbJGbjDnfJRWPC7Va38EFhd+A8JWE5/hCiKcK8qjCdbLj9DTpsq6MEudwpRTH+V4qq+Jw7d3pUgQdSr3x3mTA==", - "_location": "/flip-pixels", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "flip-pixels@^1.0.1", - "name": "flip-pixels", - "escapedName": "flip-pixels", - "rawSpec": "^1.0.1", - "saveSpec": null, - "fetchSpec": "^1.0.1" - }, - "_requiredBy": [ - "/image-pixels", - "/pxls" - ], - "_resolved": "https://registry.npmjs.org/flip-pixels/-/flip-pixels-1.0.2.tgz", - "_shasum": "aad7b7d9fc65932d5f27e2e4dac4b494140845e4", - "_spec": "flip-pixels@^1.0.1", - "_where": "/home/sigonasr2/divar/server/node_modules/image-pixels", - "author": { - "name": "dy" - }, - "bugs": { - "url": "https://github.com/dy/flip-pixels/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Flip pixel data after readPixels", - "homepage": "https://github.com/dy/flip-pixels#readme", - "keywords": [ - "readPixels", - "webgl", - "gl", - "stackgl", - "pixels" - ], - "license": "MIT", - "main": "index.js", - "name": "flip-pixels", - "repository": { - "type": "git", - "url": "git+https://github.com/dy/flip-pixels.git" - }, - "scripts": { - "test": "node test" - }, - "version": "1.0.2" -} diff --git a/server/node_modules/flip-pixels/readme.md b/server/node_modules/flip-pixels/readme.md deleted file mode 100644 index 1c693bb..0000000 --- a/server/node_modules/flip-pixels/readme.md +++ /dev/null @@ -1,18 +0,0 @@ -[![Build Status](https://travis-ci.org/dy/flip-pixels.svg?branch=master)](https://travis-ci.org/dy/flip-pixels) - -Flip pixels after `gl.readTexture`: - -```js -var flip = require('flip-pixels') - -var w = gl.drawingBufferWidth; -var h = gl.drawingBufferHeight -var pixels = new Uint8Array(w * h * 4); -gl.readPixels(0, 0, w, h, gl.RGBA, gl.UNSIGNED_BYTE, pixels); - -flip(pixels, w, h) -``` - -Based on [this question](https://stackoverflow.com/questions/41969562/how-can-i-flip-the-result-of-webglrenderingcontext-readpixels). - -See also [clip-pixels](https://ghub.io/clip-pixels). diff --git a/server/node_modules/flip-pixels/test.js b/server/node_modules/flip-pixels/test.js deleted file mode 100644 index 7c61f7a..0000000 --- a/server/node_modules/flip-pixels/test.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict' - -var flip = require('./') -var a = require('assert') - -a.deepEqual(flip([0,1,1,0], 2, 2), [1,0,0,1]) - -var x = [0,1,1,0] -a.equal(flip(x, 2, 2), x) diff --git a/server/node_modules/get-pixels/LICENSE b/server/node_modules/get-pixels/LICENSE deleted file mode 100644 index 8ce206a..0000000 --- a/server/node_modules/get-pixels/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ - -The MIT License (MIT) - -Copyright (c) 2013 Mikola Lysenko - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/server/node_modules/get-pixels/README.md b/server/node_modules/get-pixels/README.md deleted file mode 100644 index 9b536bf..0000000 --- a/server/node_modules/get-pixels/README.md +++ /dev/null @@ -1,44 +0,0 @@ -get-pixels -========== -Given a URL/path, grab all the pixels in an image and return the result as an [ndarray](https://github.com/mikolalysenko/ndarray). Written in 100% JavaScript, works both in browserify and in node.js and has no external native dependencies. - -Currently the following file formats are supported: - -* `PNG` -* `JPEG` -* `GIF` - -Example -======= - -```javascript -var getPixels = require("get-pixels") - -getPixels("lena.png", function(err, pixels) { - if(err) { - console.log("Bad image path") - return - } - console.log("got pixels", pixels.shape.slice()) -}) -``` - -Install -======= - - npm install get-pixels - -### `require("get-pixels")(url[, type], cb(err, pixels))` -Reads all the pixels from url into an ndarray. - -* `url` is the path to the file. It can be a relative path, an http url, a data url, or an [in-memory Buffer](http://nodejs.org/api/buffer.html). -* `type` is an optional mime type for the image (required when using a Buffer) -* `cb(err, pixels)` is a callback which gets triggered once the image is loaded. - -**Returns** An ndarray of pixels in raster order having shape equal to `[width, height, channels]`. - -**Note** For animated GIFs, a 4D array is returned with shape `[numFrames, width, height, 4]`, where each frame is a slice of the final array. - -Credits -======= -(c) 2013-2014 Mikola Lysenko. MIT License diff --git a/server/node_modules/get-pixels/dom-pixels.js b/server/node_modules/get-pixels/dom-pixels.js deleted file mode 100644 index 7714528..0000000 --- a/server/node_modules/get-pixels/dom-pixels.js +++ /dev/null @@ -1,135 +0,0 @@ -'use strict' - -var path = require('path') -var ndarray = require('ndarray') -var GifReader = require('omggif').GifReader -var pack = require('ndarray-pack') -var through = require('through') -var parseDataURI = require('data-uri-to-buffer') - -function defaultImage(url, cb) { - var img = new Image() - img.crossOrigin = "Anonymous" - img.onload = function() { - var canvas = document.createElement('canvas') - canvas.width = img.width - canvas.height = img.height - var context = canvas.getContext('2d') - context.drawImage(img, 0, 0) - var pixels = context.getImageData(0, 0, img.width, img.height) - cb(null, ndarray(new Uint8Array(pixels.data), [img.width, img.height, 4], [4, 4*img.width, 1], 0)) - } - img.onerror = function(err) { - cb(err) - } - img.src = url -} - -//Animated gif loading -function handleGif(data, cb) { - var reader - try { - reader = new GifReader(data) - } catch(err) { - cb(err) - return - } - if(reader.numFrames() > 0) { - var nshape = [reader.numFrames(), reader.height, reader.width, 4] - var ndata = new Uint8Array(nshape[0] * nshape[1] * nshape[2] * nshape[3]) - var result = ndarray(ndata, nshape) - try { - for(var i=0; i 0) { - var nshape = [reader.numFrames(), reader.height, reader.width, 4] - try { - var ndata = new Uint8Array(nshape[0] * nshape[1] * nshape[2] * nshape[3]) - } catch(err) { - cb(err) - return - } - var result = ndarray(ndata, nshape) - try { - for(var i=0; i 0) { - // var nshape = [reader.numFrames(), reader.height, reader.width, 4] - // try { - // var ndata = new Uint8Array(nshape[0] * nshape[1] * nshape[2] * nshape[3]) - // } catch(err) { - // cb(err) - // return - // } - - // var result = ndarray(ndata, nshape) - // try { - // for(var i=0; i < reader.numFrames(); ++i) { - // reader.decodeAndBlitFrameRGBA(i, ndata.subarray( - // result.index(i, 0, 0, 0), - // result.index(i+1, 0, 0, 0))) - // } - // } catch(err) { - // cb(err) - // return - // } - - // cb(null, result.transpose(0,2,1)) - // } - - // single frame gif - var pixels = new Uint8Array(reader.width * reader.height * 4) - - reader.decodeAndBlitFrameRGBA(0, pixels) - - return { - data: pixels, - width: reader.width, - height: reader.height - } -} - diff --git a/server/node_modules/image-decode/index.js b/server/node_modules/image-decode/index.js deleted file mode 100644 index e30fb99..0000000 --- a/server/node_modules/image-decode/index.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict' - -var detectType = require('image-type') -var toab = require('to-array-buffer') - -module.exports = decode - - -function decode (data, o) { - data = toab(data) - - if (!data) return null - - if (!o) o = {} - else if (typeof o === 'string') o = {type: o} - - var type = o.type - - if (!type) { - type = detectType(new Uint8Array(data)) - - // we do not throw an error since argument can be decoded data already - if (!type) return null - - type = type.mime - - if (!decode[type]) throw Error('Type `' + type + '` does not seem to be supported') - } - - return decode[type](data, o) -} - - -decode['png'] = -decode['image/png'] = require('./png') -decode['gif'] = -decode['image/gif'] = require('./gif'), -decode['image/jpeg'] = -decode['image/jpg'] = -decode['jpg'] = -decode['jpeg'] = require('./jpg') -decode['bmp'] = -decode['image/bmp'] = -decode['image/bitmap'] = require('./bmp') -decode['tiff'] = -decode['image/tiff'] = require('./tiff') -decode['webp'] = -decode['image/webp'] = require('./webp') diff --git a/server/node_modules/image-decode/jpg.js b/server/node_modules/image-decode/jpg.js deleted file mode 100644 index 1a743a5..0000000 --- a/server/node_modules/image-decode/jpg.js +++ /dev/null @@ -1,22 +0,0 @@ -// decode jpeg buffer -'use strict' - -var jpeg = require('jpeg-js') -var b2u8 = require('buffer-to-uint8array') - -module.exports = read - -function read (data, o) { - var jpegData = jpeg.decode(data) - - if(!jpegData) { - throw new Error("Error decoding jpeg") - } - - return { - data: b2u8(jpegData.data), - height: jpegData.height, - width: jpegData.width - } -} - diff --git a/server/node_modules/image-decode/package.json b/server/node_modules/image-decode/package.json deleted file mode 100644 index 232acc8..0000000 --- a/server/node_modules/image-decode/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "_from": "image-decode@^1.1.0", - "_id": "image-decode@1.2.2", - "_inBundle": false, - "_integrity": "sha512-WJSWrPNmEnWVYGkY22bA6206MKYjfGl01fdlwIp6ovdnPL2qGJyC3wQj8QqYbdblchzwgglFg8Jcb/1f6fhaTQ==", - "_location": "/image-decode", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "image-decode@^1.1.0", - "name": "image-decode", - "escapedName": "image-decode", - "rawSpec": "^1.1.0", - "saveSpec": null, - "fetchSpec": "^1.1.0" - }, - "_requiredBy": [ - "/image-pixels" - ], - "_resolved": "https://registry.npmjs.org/image-decode/-/image-decode-1.2.2.tgz", - "_shasum": "4ca74fc534e7133c5096ed712d8c5bceb5ba1fc6", - "_spec": "image-decode@^1.1.0", - "_where": "/home/sigonasr2/divar/server/node_modules/image-pixels", - "author": { - "name": "dy" - }, - "bugs": { - "url": "https://github.com/dy/image-decode/issues" - }, - "bundleDependencies": false, - "dependencies": { - "bmp-js": "^0.1.0", - "buffer-to-uint8array": "^1.1.0", - "image-type": "^3.0.0", - "jpeg-js": "^0.3.4", - "omggif": "^1.0.9", - "pngjs": "^3.3.3", - "to-array-buffer": "^3.0.0", - "utif": "^2.0.1" - }, - "deprecated": false, - "description": "Decode image data from gif, jpeg, png, tiff or bmp", - "devDependencies": { - "brfs": "^2.0.1", - "image-equal": "^3.1.0", - "tape": "^4.9.1" - }, - "homepage": "https://github.com/dy/image-decode#readme", - "keywords": [ - "image", - "image-decode", - "get-pixels", - "image-pixels", - "pixels" - ], - "license": "MIT", - "main": "index.js", - "name": "image-decode", - "repository": { - "type": "git", - "url": "git+https://github.com/dy/image-decode.git" - }, - "scripts": { - "test": "node test" - }, - "version": "1.2.2" -} diff --git a/server/node_modules/image-decode/png.js b/server/node_modules/image-decode/png.js deleted file mode 100644 index 1275fbe..0000000 --- a/server/node_modules/image-decode/png.js +++ /dev/null @@ -1,19 +0,0 @@ -// decode png buffer -'use strict' - - -var PNG = require('pngjs').PNG -var toab = require('to-array-buffer') - -module.exports = function read (data, o) { - var imgData = PNG.sync.read(Buffer.from(data)) - - var pixels = new Uint8Array(toab(imgData.data)) - - return { - data: pixels, - width: imgData.width | 0, - height: imgData.height | 0 - } -} - diff --git a/server/node_modules/image-decode/readme.md b/server/node_modules/image-decode/readme.md deleted file mode 100644 index 3226a82..0000000 --- a/server/node_modules/image-decode/readme.md +++ /dev/null @@ -1,42 +0,0 @@ -# image-decode [![unstable](https://img.shields.io/badge/stability-unstable-green.svg)](http://github.com/badges/stability-badges) [![Build Status](https://img.shields.io/travis/dy/image-decode.svg)](https://travis-ci.org/dy/image-decode) - -Decode image data from raw encoded binary data in any image format: PNG, GIF, BMP, JPEG, TIFF. - -## Usage - -[![npm install image-decode](https://nodei.co/npm/image-decode.png?mini=true)](https://npmjs.org/package/image-decode/) - -```js -let decode = require('image-decode') - -let {data, width, height} = decode(fs.readFileSync('./data.png')) -``` - -## API - -### `let {data, width, height} = decode(buffer, mimeType?)` - -Takes input `buffer` with encoded image data and decodes its contents, returns pixels `data` array with layout `[r, g, b, a, r, g, b, a, ...]`. `mimeType` can be passed to skip image type detection. - -`buffer` can be any binary data container: - -* ArrayBuffer -* Buffer -* Uint8Array -* File -* Blob -* base64 string - - -## See also - -* [image-encode](https://ghub.io/image-encode) − encode pixels data to target format. -* [image-equal](https://ghub.io/image-equal) − image data comparing tool. -* [image-pixels](https://ghub.io/image-pixels) − load or save pixel data from/to any source. -* [image-save](https://ghub.io/image-save) − save image pixels data to a target. -* [image-type](https://ghub.io/image-type) − detect input image data type. - - -## Credits - -© 2018 Dmitry Yv. MIT License. diff --git a/server/node_modules/image-decode/test.js b/server/node_modules/image-decode/test.js deleted file mode 100644 index 49cda90..0000000 --- a/server/node_modules/image-decode/test.js +++ /dev/null @@ -1,85 +0,0 @@ -'use strict' - -let decode = require('./') -let t = require('tape') -let fix = require('./fixture') -let fs = require('fs') -let eq = require('image-equal') - - -t('png', async t => { - let data = decode(fs.readFileSync('./fixture/test_pattern.png')) - - t.ok(await eq(data, fix)) - - t.equal(data.width, fix.width) - t.equal(data.height, fix.height) - - t.end() -}) - -t('jpg', async t => { - let data = decode(fs.readFileSync('./fixture/test_pattern.jpg')) - - t.ok(await eq(data, fix, {tol: 0.04})) - - t.equal(data.width, fix.width) - t.equal(data.height, fix.height) - t.end() -}) - -t('bmp', async t => { - let data = decode(fs.readFileSync('./fixture/test_pattern.jpg')) - - t.ok(await eq(data, fix, {tol: 0.04})) - - t.equal(data.width, fix.width) - t.equal(data.height, fix.height) - t.end() -}) - -t('gif', async t => { - let data = decode(fs.readFileSync('./fixture/test_pattern.gif')) - - t.ok(await eq(data, fix)) - - t.equal(data.width, fix.width) - t.equal(data.height, fix.height) - t.end() -}) - -t.skip('webp', async t => { - let data = decode(fs.readFileSync('./fixture/test_pattern.webp')) - - t.ok(await eq(data, fix)) - - t.equal(data.width, fix.width) - t.equal(data.height, fix.height) - t.end() -}) - -t('tiff', async t => { - let data = decode(fs.readFileSync('./fixture/test_pattern.tif')) - - t.ok(await eq(data, fix)) - - t.equal(data.width, fix.width) - t.equal(data.height, fix.height) - t.end() -}) - -t('undefined type', async t => { - let data = decode([0,0,0,0,0,0,0,0,0]) - t.notOk(data) - - t.end() -}) - -// TODO -t('base64') -t('arraybuffer') -t('buffer') -t('uint8') -t('file') -t('blob') -t('datauri') diff --git a/server/node_modules/image-decode/tiff.js b/server/node_modules/image-decode/tiff.js deleted file mode 100644 index 4d71a33..0000000 --- a/server/node_modules/image-decode/tiff.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict' - -var UTIF = require('utif') - -module.exports = function decode(data, o) { - var ifds = UTIF.decode(data) - UTIF.decodeImages(data, ifds) - - var rgba = UTIF.toRGBA8(ifds[0]) - - return { - data: rgba, - height: ifds[0].height, - width: ifds[0].width - } -} diff --git a/server/node_modules/image-decode/webp.js b/server/node_modules/image-decode/webp.js deleted file mode 100644 index df6065f..0000000 --- a/server/node_modules/image-decode/webp.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict' - -module.exports = function decode (data, o) { - -} diff --git a/server/node_modules/image-pixels/.eslintrc.json b/server/node_modules/image-pixels/.eslintrc.json deleted file mode 100644 index 27466ea..0000000 --- a/server/node_modules/image-pixels/.eslintrc.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "env": { - "browser": true, - "node": true, - "commonjs": true, - "es6": true - }, - "parserOptions": { - "ecmaVersion": 8 - }, - "extends": "eslint:recommended", - "rules": { - "strict": 2, - "indent": 0, - "linebreak-style": 0, - "quotes": 0, - "semi": 0, - "no-cond-assign": 1, - "no-constant-condition": 1, - "no-duplicate-case": 1, - "no-empty": 1, - "no-ex-assign": 1, - "no-extra-boolean-cast": 1, - "no-extra-semi": 1, - "no-fallthrough": 1, - "no-func-assign": 1, - "no-global-assign": 1, - "no-implicit-globals": 2, - "no-inner-declarations": ["error", "functions"], - "no-irregular-whitespace": 2, - "no-loop-func": 1, - "no-magic-numbers": ["warn", { "ignore": [1, 0, -1], "ignoreArrayIndexes": true}], - "no-multi-str": 1, - "no-mixed-spaces-and-tabs": 1, - "no-proto": 1, - "no-sequences": 1, - "no-throw-literal": 1, - "no-unmodified-loop-condition": 1, - "no-useless-call": 1, - "no-void": 1, - "no-with": 2, - "wrap-iife": 1, - "no-redeclare": 1, - "no-unused-vars": ["error", { "vars": "all", "args": "none" }], - "no-sparse-arrays": 1 - } -} diff --git a/server/node_modules/image-pixels/.travis.yml b/server/node_modules/image-pixels/.travis.yml deleted file mode 100644 index a7e0989..0000000 --- a/server/node_modules/image-pixels/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: node_js -os: linux -sudo: required -dist: trusty -addons: - apt: - packages: - - libxi-dev - - mesa-utils - - xvfb - - libgl1-mesa-dri - - libglapi-mesa - - libosmesa6 -node_js: - - '10' -before_script: - - export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start diff --git a/server/node_modules/image-pixels/index.js b/server/node_modules/image-pixels/index.js deleted file mode 100644 index 7242141..0000000 --- a/server/node_modules/image-pixels/index.js +++ /dev/null @@ -1,277 +0,0 @@ -'use strict' - -var isObj = require('is-plain-obj') -var isBase64 = require('is-base64') -var rect = require('parse-rect') -var extend = require('object-assign') -var isBlob = require('is-blob') -var clipPixels = require('clip-pixels') -var isBrowser = require('is-browser') -var loadUrl = require('./lib/url') -var loadRaw = require('./lib/raw') -var loadGl = require('./lib/gl') -var cache = require('./lib/cache') -var pxls = require('pxls') - -module.exports = function (src, o, cb) { - // tagged template - if (Array.isArray(src) && src.raw) src = String.raw.apply(this, arguments) - - // detect callback arg - if (typeof o === 'function') { - cb = o - o = isObj(src) ? src : null - } - - return getPixels(src, o).then(function (data) { - // cache self pixel data - if (!cache.get(data)) { - cache.set(data, data) - } - - if (cb) cb(null, data) - return data - }, function (err) { - if (cb) cb(err) - throw err - }) -} - -module.exports.cache = cache - -module.exports.all = function getPixelsAll (src, o, cb) { - if (!src) return null - - if (typeof o === 'function') { - cb = o - o = null - } - - // list - if (Array.isArray(src)) { - var list = src.map(function (source) { - return getPixels(source, o) - }) - - // return promise resolved with list - return Promise.all(list).then(function (list) { - cb && cb(null, list) - return list - }, function (err) { - cb && cb(err) - return Promise.reject(err) - }) - } - - // dict - var handlers = {} - var list = [] - for (var name in src) { - handlers[name] = list.push(getPixels(src[name], o)) - 1 - } - - // return promise resolved with dict - return Promise.all(list).then(function (list) { - var result = {} - for (var name in handlers) { - result[name] = list[handlers[name]] - } - cb && cb(null, result) - return result - }, function (err) { - cb && cb(err) - return Promise.reject(err) - }) -} - - -function getPixels(src, o) { - // handle arguments - if (typeof o === 'string') o = {type: o} - else if (!o) o = {} - else if (Array.isArray(o)) o = {shape: o} - else o = extend({}, o) - - var cached - - // cases when the source in options and options are in the source - if (isObj(src)) o = extend(src, o) - if (o.src || o.source) src = o.src || o.source - if (isObj(src) && (src.src || src.source)) src = src.src || src.source - if (!src) src = {} - - // turn cache on by default - if (o.cache == null) o.cache = true - - // detect clipping - var width, height - var clip = o.clip && rect(o.clip) || {x: 0, y: 0} - var type = o.type || o.mime - - if (cached = checkCached(src, clip)) return cached - - var cacheAs = [] - captureShape(o) - captureShape(src) - - // File & Blob - if (isBrowser && (isBlob(src) || (src instanceof File))) { - // FIXME: try to use createImageBitmap for Blob - src = URL.createObjectURL(src) - cacheAs.push(src) - - if (cached = checkCached(src, clip)) return cached - - // TODO: detect raw data and decode here, possibly use array-buffer - } - - // handle source type - if (typeof src === 'string') { - if (!src) return Promise.reject(new Error('Bad URL')) - - cacheAs.push(src) - - // convert base64 to datauri - if (isBase64(src, {mime: false})) { - src = pxls(src) - - return loadRaw(src, {type: type, cache: o.cache && cacheAs, shape: [width, height], clip: clip}) - } - - // url, path, datauri - return loadUrl(src, clip).then(function (src) { - if (cached = checkCached(src, clip)) { - return cached - } - - captureShape(src) - return loadRaw(src, {type: type, cache: o.cache && cacheAs, shape: [width, height], clip: clip}) - }) - } - - if (src.tagName) { - // SVG Image - if (src.tagName.toLowerCase() === 'image') { - var url = src.getAttribute('xlink:href') - src = new Image() - src.src = url - if (cached = checkCached(url, clip)) return cached - } - - // fetch closest image/video - if (src.tagName.toLowerCase() === 'picture') { - src = src.querySelector('img') - if (cached = checkCached(src, clip)) return cached - } - - // - if (src.tagName.toLowerCase() === 'img') { - if (cached = checkCached(src.src, clip)) return cached - - cacheAs.push(src.src) - - if (src.complete) { - captureShape(src) - return loadRaw(src, {type: type, cache: o.cache && cacheAs, shape: [width, height], clip: clip}) - } - - return new Promise(function (ok, nok) { - src.addEventListener('load', function () { - captureShape(src) - ok(src) - }) - src.addEventListener('error', function(err) { - nok(err) - }) - }).then(function (src) { - return loadRaw(src, {type: type, cache: o.cache && cacheAs, shape: [width, height], clip: clip}) - }) - } - - //