Comments (8)
Next I tried to dynamically import so I did:
var flacBindings = require('flac-bindings');
instead of
var flacBindings = require('flac-bindings');
But then I get an error in the next line if I like to create an instance of StreamEncoder:
/home/pi/rooExtend/modPlay.js:928
var encoder = new StreamEncoder({
^
TypeError: StreamEncoder is not a constructor
from node-flac-bindings.
OK, for all with the same issue I will publish the solution 👍
This was the code before:
var flacBindings = require('flac-bindings');
StreamEncoder = flacBindings.StreamEncoder;
// ... your code continues here...
This is the code that you have to use now. It dynamically loads the module and this takes some time.
Therefore you have to wait and continue asynchronously...
import('flac-bindings')
.then(flacBindings => {
StreamEncoder = flacBindings.StreamEncoder;
// ... after loading the flac-bindings your code continues here...
})
.catch(err => {
console.log('Cannot load flac-bindings ' + err);
})
Hope this is useful for someone else but me.
@melchor629
will be great if you might add this to your README file
Best DrCWO
from node-flac-bindings.
Hi DrCWO! Thanks for opening the issue.
This is a known "pain point" of the 3.x series. In release notes I pointed it out that this was happening and added this link https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c which explains a bit what happens and what you can do to fix it. You can always keep using 2.x series meanwhile or use the dynamic import()
syntax.
In addition, because I imagined that this would be a recurrent issue, the README also contains this line to warn the devs. I see I should make it even clearer.
Sorry for this confusion. I wanted to move forward with the technology and I know that this can be a bit frustrating. I hope you could find the above link useful.
from node-flac-bindings.
Related Issues (20)
- Can't instantiate flac.FileDecoder HOT 9
- prebuild-install WARN install No prebuilt binaries found (target=12.18.0 runtime=node arch=x64 libc= platform=win32) HOT 8
- Any documentation on how to write metadata to a flac file? HOT 5
- FLAC StreamDecoder unable to decode file when FileDecoder does HOT 17
- library is not loaded dynamically as the doc says HOT 5
- "Encoder has not been initialized yet" Error raised while using StreamEncoder HOT 7
- Installation fails on Android HOT 4
- Crashes on node 14.x HOT 2
- how to create metadata HOT 4
- Illegal instruction (Core dumped) error on Synology DS718+ HOT 10
- Decoder initialization failed: Error_opening_file HOT 26
- When I packaged the Electron project, it didn't work HOT 8
- Windows build errors HOT 11
- A specific song cannot be converted on windows HOT 16
- upgrade to 3.0.0, ES module error HOT 15
- macbook pro m1, 13.2 (22D49) can't load libflac HOT 6
- 24bit encoding HOT 7
- FLAC compressionLevel parameter is ignored HOT 5
- Miss check object on ptr HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-flac-bindings.