Add eslint & update README
This commit is contained in:
parent
31b4857437
commit
26aed33e69
6
.eslintrc
Normal file
6
.eslintrc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"extends": "airbnb-base",
|
||||||
|
"rules": {
|
||||||
|
"no-underscore-dangle": 0
|
||||||
|
}
|
||||||
|
}
|
@ -1,2 +1,4 @@
|
|||||||
|
.eslintrc
|
||||||
|
.github
|
||||||
tests
|
tests
|
||||||
examples
|
examples
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
FFmpeg.js
|
FFmpeg.js
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="#"><img alt="Tesseract.js" src="https://github.com/naptha/tesseract.js/raw/master/docs/images/cover.png"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
A FFmpeg WebAssembly version built from scratch, you can learn how to do it from this series of stories: [Build FFmpeg WebAssembly version (=ffmpeg.js)](https://medium.com/@jeromewus/build-ffmpeg-webassembly-version-ffmpeg-js-part-1-preparation-ed12bf4c8fac).
|
A FFmpeg WebAssembly version built from scratch, you can learn how to do it from this series of stories: [Build FFmpeg WebAssembly version (=ffmpeg.js)](https://medium.com/@jeromewus/build-ffmpeg-webassembly-version-ffmpeg-js-part-1-preparation-ed12bf4c8fac).
|
||||||
|
|
||||||
---
|
---
|
||||||
|
BIN
docs/images/cover.png
Normal file
BIN
docs/images/cover.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
1495
package-lock.json
generated
1495
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,8 @@
|
|||||||
"example": "examples"
|
"example": "examples"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha"
|
"test": "mocha",
|
||||||
|
"lint": "eslint src"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -26,5 +27,10 @@
|
|||||||
"homepage": "https://github.com/jeromewu/ffmpeg.js#readme",
|
"homepage": "https://github.com/jeromewu/ffmpeg.js#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ffmpeg/core": "^0.1.0"
|
"@ffmpeg/core": "^0.1.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^6.1.0",
|
||||||
|
"eslint-config-airbnb-base": "^14.0.0",
|
||||||
|
"eslint-plugin-import": "^2.18.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
const { setModule } = require('./util/module');
|
|
||||||
const FFmpegCore = require('@ffmpeg/core');
|
const FFmpegCore = require('@ffmpeg/core');
|
||||||
|
const { setModule } = require('./util/module');
|
||||||
|
|
||||||
module.exports = () => (
|
module.exports = () => (
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve) => {
|
||||||
FFmpegCore()
|
FFmpegCore()
|
||||||
.then((Module) => {
|
.then((Module) => {
|
||||||
setModule(Module);
|
setModule(Module);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
let Module = null;
|
let Module = null;
|
||||||
|
|
||||||
exports.setModule = m => {
|
exports.setModule = (m) => {
|
||||||
Module = m;
|
Module = m;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ const { getModule } = require('./module');
|
|||||||
module.exports = (s) => {
|
module.exports = (s) => {
|
||||||
const Module = getModule();
|
const Module = getModule();
|
||||||
const ptr = Module._malloc((s.length + 1) * Uint8Array.BYTES_PER_ELEMENT);
|
const ptr = Module._malloc((s.length + 1) * Uint8Array.BYTES_PER_ELEMENT);
|
||||||
for (let i = 0; i < s.length; i++) {
|
for (let i = 0; i < s.length; i += 1) {
|
||||||
Module.setValue(ptr + i, s.charCodeAt(i), 'i8');
|
Module.setValue(ptr + i, s.charCodeAt(i), 'i8');
|
||||||
}
|
}
|
||||||
Module.setValue(ptr + s.length, 0, 'i8');
|
Module.setValue(ptr + s.length, 0, 'i8');
|
||||||
|
Loading…
Reference in New Issue
Block a user