#StackBounty: #node.js #mongodb #ffmpeg #fluent-ffmpeg fluent-ffmpeg from an array of input files

Bounty: 50

I want to use fluent-ffmpeg to create a video of last n images of a directory, or database entries.

Which is the correct syntax?

These are my tries:

Mimic shell command

ffmpeg()
  .addInput('ls *png | tail -n 17')
  .inputOptions("-pattern_type glob")
  .output("output.mp4").run()

but it does not accept shell commands;

space – separated paths

ffmpeg()
  .addInput('a*.png b*.png ')
  .inputOptions("-pattern_type glob")
  .output("output.mp4").run()

but it does not accept list of files separated by spaces;

Array of image paths

ffmpeg()
  .addInput(array) // ['aa.png', 'a1.png',,,'bbb.png']
  .inputOptions("-pattern_type glob")
  .output("output.mp4").run()

but it does not accept arrays.

EDIT:

Also, from Merge Multiple Videos using node fluent ffmpeg, I am able to add multiple inputs using an array of files as

var ffmpeg= require('fluent-ffmpeg');
var f=ffmpeg() 
pngarr.forEach(p => f.input(p)) /// pngarr is my array of png paths

But running

f.output("./output.mp4").run()

I obtain just a video of 0 seconds containing the first png of the list.


Get this bounty!!!

#StackBounty: #node.js #typescript #webstorm WebStorm tsconfig.json appears to not update the correct files

Bounty: 50

I am developing a node.js application using TypeScript.

I’ve created a TypeScript file in the root folder of my project. I run tsconfig and it appears to update the dist folder. However, when I run the app, I am getting an error indicating a function is not defined.

Here is where things get confusing: there seems to be older versions of the .js and .map files in my src folder in the same directories as my source files with the same names. This .js file seems to have an older version of the file missing the necessary functions (class methods), different from the current versions in my /dist folder.

At the end of the day, I am trying to run the debugger on the files in my /dist folder and set breakpoints over in my /src TypeScript files.

This is a sample of the file structure I am seeing in my /src folder (this js file is not current):

enter image description here

Here is a sample of the file structure of my /dist folder where the transpiled js code resides:

enter image description here

Also, here are the debugger settings for the web app (rest) portion of the project:

enter image description here

Finally, here is a sample of the tsconfig.json file:

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "ES5",
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "types": ["reflect-metadata"],
    "lib": ["ES6"],
    "sourceMap": true,
    "inlineSources": true,
    "pretty": true,
    "outDir": "./dist",
    "rootDir": "./src/",
    "noLib": false
  },
  "compileOnSave": true,
  "include": [
    "src/**/*"
  ],
  "exclude": [
    "node_modules",
    "node_modules/@types"
  ]
}
  1. I would like to understand what is wrong, causing it to read the wrong js files, instead of the ones in the /dist folder?

  2. What can I do to fix this to point to the /dist folder. I thought the debugger settings I setup would do that, but this does not appear to be the case.

Any help would be greatly appreciated.

Update: I deleted the .js files that were generated in the src folder and they eventually returned back to the folder and once again, they were not current after making other changes. I am not sure what is generating these files; is it a setting in webstorm or is it in tsconig.json?

Something else doesn’t look right. When I opened one of the files in the dist folder, I found the following code instead of js code:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=group.js.map

This is not what I was expecting, as I was expecting to see the transpiled js code.


Get this bounty!!!

#StackBounty: #gratis #open-source #command-line #node.js Convert Website to Android APK in Command Line

Bounty: 50

I was wondering does anyone know if there’s a tool similar to nativefier that allows you to convert any website as an android app/apk?


Get this bounty!!!

#StackBounty: #node.js #express #react-router #apollo #react-apollo Server side rendering with Apollo: getaddrinfo ENOTFOUND

Bounty: 100

I’m running Apollo/React with Express and I’m trying to get server side rendering to work. The Apollo docs suggest the following initialisation code for connecting to the API server:

app.use((req, res) => {
  match({ routes, location: req.originalUrl }, (error, redirectLocation, renderProps) => {
    const client = new ApolloClient({
      ssrMode: true,
      networkInterface: createNetworkInterface({
        uri: 'http://localhost:3000', // Instead of 3010
        opts: {
          credentials: 'same-origin',
          headers: {
            cookie: req.header('Cookie'),
          },
        },
      }),
    });

    const app = (
      <ApolloProvider client={client}>
        <RouterContext {...renderProps} />
      </ApolloProvider>
    );

    getDataFromTree(app).then(() => {
      const content = ReactDOM.renderToString(app);
      const initialState = {[client.reduxRootKey]: client.getInitialState()  };
      const html = <Html content={content} state={initialState} />;
      res.status(200);
      res.send(`<!doctype html>n${ReactDOM.renderToStaticMarkup(html)}`);
      res.end();
    });

  });
});

which uses the match() function from React Router v3 (as evidenced by package.json in the “GitHunt” example linked from the docs). I’m using React Router v4 from which match() is absent, so I refactored the code as follows, using renderRoutes() from the react-router-config package.

app.use((req, res) => {
  const client = new ApolloClient(/* Same as above */)

  const context = {}

  const app = (
    <ApolloProvider client={client}>
      <StaticRouter context={context} location={req.originalUrl}>
        { renderRoutes(routes) }
      </StaticRouter>
    </ApolloProvider>
  )

  getDataFromTree(app).then(/* Same as above */)
})

My understanding is that <StaticRouter> obviates the use of match(). However react-router-config provides a matchRoutes() function which seems to provide a similar functionality (albeit without the callback) if needed.

When I visit http://localhost:3000, the page loads as expected and I can follow links to subdirectories (e.g. http://localhost:3000/folder). When I try to directly load a subdirectory by typing in the name in the address bar, my browser keeps waiting for the server to respond. After about six seconds, Terminal shows one of the following errors (not sure what causes the error to change on subsequent tries):

(node:1938) UnhandledPromiseRejectionWarning: Unhandled promise
rejection (rejection id: 1): Error: Network error: request to
http://localhost:3000 failed, reason: getaddrinfo ENOTFOUND localhost
localhost:3000

or

(node:8691) UnhandledPromiseRejectionWarning: Unhandled promise
rejection (rejection id: 1): Error: Network error: request to
http://localhost:3000 failed, reason: socket hang up

I’ve been struggling with this problem for a few hours now, but can’t seem to figure it out. The solution to a similar problem seems unrelated to this case. Any help will be much appreciated!

Further information

If I don’t kill the nodemon server, after some time I get thousands of the following errors:

POST / – – ms – –

(node:1938) UnhandledPromiseRejectionWarning:
Unhandled promise rejection (rejection id: 4443): Error: Network
error: request to http://localhost:3000 failed, reason: socket hang up

If I do kill the server, however, I immediately get this error instead:

/Users/…/node_modules/duplexer/index.js:31

writer.on("drain", function() {

      ^

TypeError: Cannot read property ‘on’ of undefined

at duplex (/Users/…/node_modules/duplexer/index.js:31:11)

at Object.module.exports (/Users/…/node_modules/stream-combiner/index.js:8:17)

at childrenOfPid (/Users/…/node_modules/ps-tree/index.js:50:6)

at kill (/Users/…/node_modules/nodemon/lib/monitor/run.js:271:7)

at Bus.onQuit (/Users/…/node_modules/nodemon/lib/monitor/run.js:327:5)

at emitNone (events.js:91:20)

at Bus.emit (events.js:188:7)

at process. (/Users/…/node_modules/nodemon/lib/monitor/run.js:349:9)

at Object.onceWrapper (events.js:293:19)

at emitNone (events.js:86:13)

Also, port 3000 is correct. If I change the number, I get a different error instead:

(node:2056) UnhandledPromiseRejectionWarning: Unhandled promise
rejection (rejection id: 1): Error: Network error: request to
http://localhost:3010 failed, reason: connect ECONNREFUSED
127.0.0.1:3010


Get this bounty!!!

#StackBounty: #javascript #node.js #firebase #google-cloud-platform #google-cloud-storage Why is my solution so slow and how can I impr…

Bounty: 100

Currently I was able to optimise performance quite a bit, but it is still somewhat slow :/

LATEST EDIT:

My current solution (the fastest atm (but still slow) and keeps order):

server

router.post('/images', function(req, res, next) {
    var image = bucket.file(req.body.image);
    image.download(function(err, contents) {
        if (err) {
            console.log(err);
        } else {
            var resultImage = base64_encode(contents);
            var index = req.body.index;
            var returnObject = {
                image: resultImage,
                index: index
            }
            res.send(returnObject);
        }
    });
});

client query

$scope.getDataset = function() {

                fb.orderByChild('id').startAt(_start).limitToFirst(_n).once("value", function(dataSnapshot) {

                    dataSnapshot.forEach(function(childDataSnapshot) {
                        _start = childDataSnapshot.child("id").val() + 1;

                        var post = childDataSnapshot.val();
                        var image = post.image;

                        var imageObject = {
                            image: image,
                            index: position
                        };
                        position++;
                        $.ajax({
                            type: "POST",
                            url: "images",
                            data: imageObject,
                        }).done(function(result) {
                            post.image = result.image;
                            $scope.data[result.index] = post;
                            $scope.$apply();
                            firstElementsLoaded = true; 
                        });
                    })  
                });
            };

client HTML

{{d.title}} by {{d.username}}

-50}}">
{{d.upvotes - d.downvotes}} HP
</div> </div> </div>


Get this bounty!!!

#StackBounty: #angularjs #node.js #excel #google-sheets-api #hebrew Using Google Sheets to create a .xslx file from sql data

Bounty: 50

I am trying to create a .xlsx file with data I retrieve from mysql to a node.js server that serves an angularjs project, but after hours of trying to find something via npm or google I almost gave up!

The two main problems I have are:

  • My data is in hebrew (i.e. rtl styling + different characters).
  • The Excel file that I export needs to be styled in a specific way, and it is a pain trying to style an excel file grammatically.

And then I had an idea!

What if I could create a google sheet doc in my google drive as a template including the styling, and then when the user clicks to create a new doc, I would just duplicate this template, and change the values to the new data.

But just trying to understand the google api is a headache on its on, apparently, there are 3! different api’s: Drive, Sheets and auth.

So my question is as follows.

  • Is my idea valid? does anyone think it could work?
  • Where would I start, is there some guide or npm that would help?

Please don’t comment to look in the docs, I am having a hard time to understand where to start from there.


Get this bounty!!!

#StackBounty: #node.js #npm What does npm's error message The package grunt does not satisfy its siblings' peerDependencies … t…

Bounty: 50

On an little outdated npm/node-platform I’m getting this error while trying to install grunt.

npm ERR! peerinvalid The package grunt does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer grunt-bake@0.2.1 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-contrib-copy@0.4.1 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-contrib-clean@0.5.0 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-contrib-sass@0.8.1 wants grunt@>=0.4.0
npm ERR! peerinvalid Peer grunt-http-server@1.1.0 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-contrib-watch@0.6.1 wants grunt@~0.4.0

npm ERR! System Linux 4.9.25
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "grunt"
npm ERR! cwd /some_workpath/workspace/1.1_build/src/main/grunt
npm ERR! node -v v0.10.21
npm ERR! npm -v 1.3.11
npm ERR! code EPEERINVALID

The issue: I have no clue what’s npm trying to tell me.


Get this bounty!!!

#StackBounty: #node.js #xcode #reactjs #npm #react-native React native deploying on iOS device stuck on Running 1 of 1 custom shell scr…

Bounty: 50

I’m trying to run a React Native application on iOS device. It works fine on simulator, but while running on device it takes long 20-25 minutes to run. I get stuck on Running 1 of 1 custom shell script.

I tried deleting npm, clearing watchman, resetting npm cache, updated React version, Watchman version, etc., but nothing worked. I even tried to deploy to device using commands even that is taking lot of time.

Attaching screenshot for reference.

xCode output


Get this bounty!!!

#StackBounty: #node.js #npm What does npm's error message The package grunt does not satisfy its siblings' peerDependencies … t…

Bounty: 50

On an little outdated npm/node-platform I’m getting this error while trying to install grunt.

npm ERR! peerinvalid The package grunt does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer grunt-bake@0.2.1 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-contrib-copy@0.4.1 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-contrib-clean@0.5.0 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-contrib-sass@0.8.1 wants grunt@>=0.4.0
npm ERR! peerinvalid Peer grunt-http-server@1.1.0 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-contrib-watch@0.6.1 wants grunt@~0.4.0

npm ERR! System Linux 4.9.25
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "grunt"
npm ERR! cwd /some_workpath/workspace/1.1_build/src/main/grunt
npm ERR! node -v v0.10.21
npm ERR! npm -v 1.3.11
npm ERR! code EPEERINVALID

The issue: I have no clue what’s npm trying to tell me.


Get this bounty!!!

#StackBounty: #node.js #npm What does npm's error message The package grunt does not satisfy its siblings' peerDependencies … t…

Bounty: 50

On an little outdated npm/node-platform I’m getting this error while trying to install grunt.

npm ERR! peerinvalid The package grunt does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer grunt-bake@0.2.1 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-contrib-copy@0.4.1 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-contrib-clean@0.5.0 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-contrib-sass@0.8.1 wants grunt@>=0.4.0
npm ERR! peerinvalid Peer grunt-http-server@1.1.0 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-contrib-watch@0.6.1 wants grunt@~0.4.0

npm ERR! System Linux 4.9.25
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "grunt"
npm ERR! cwd /some_workpath/workspace/1.1_build/src/main/grunt
npm ERR! node -v v0.10.21
npm ERR! npm -v 1.3.11
npm ERR! code EPEERINVALID

The issue: I have no clue what’s npm trying to tell me.


Get this bounty!!!