how to execute flash external code in nodejs? - node.js

I was wondering if there is a way to run flash SWF files in nodejs?
Here's what i have:
I have an SWF file which has some functions defined as externalinterface to be called in javascript like this:
$("#the-swf-element).myFunction(123);
Now i want to do this in nodejs outside of browser. Is there any way to do this?
Couldn't find any npm package for it.
All solutions are welcome, even running it in phantomjs

Related

Can I run A-Frame in node.js (server-side)?

I'd like to take a lot of screenshots and export .glb from thousands of generated a-frame models. Since I can't save files from the browser without prompt, generating the models on the server-side with node.js would be awesome.
(As a workaround I could probably generate the models in the browser and POST them to a local server that saves the files to disk but I'd prefer the server-side rendering if possible)
So, how can I render A-Frame models in node.js?
Tried approaches like this with mock-browser for mocking the DOM (which is necessary in three, let alone DOM-based a-frame) and headless-gl for creating a WebGL context in node.
No luck there, so I settled with an electron application.
tldr: check this out. Download, npm install; npm run start; and render screenshots / export the scene as glb. If you like it, let me know how to improve it to make it more useful.
non tldr:
You can load up an a-frame website using electron, but use the main process to save the screenshot on your drive - so there are no prompts, and it can be automated.
To make a render, You can simply use the native screenshot component to create a canvas containing the screenshot image
document.querySelector('a-scene').components.screenshot.getCanvas('equirectangular');
but instead of downloading the blob, pass it into the main process via an renderer to main IPC channel - where you can save it on your drive.

Reference compiled React javascript from Nodejs server

I have a React app that renders markup based on user input and I need to be able to render the markup the same way without a client. I've seen other people accomplish this by using Nodejs, is it possible to access React Components from Node given a reference to a compiled and minified Javascript file (this file is my React code bundled).
Yes, that is certainly possible with something like reactDOMServer. You can read more at: https://reactjs.org/docs/react-dom-server.html
What are you trying to do exactly? Are you trying to do it on a server? Or just on a command line? Are you using any bundlers like Webpack or Parcel?

Launching a file using NodeJS

I was wondering how I could launch a file using nodejs. Specifically I wanted to be able to run a nodejs file and inside the code, it will open up a certain file on my local hard drive. So I want to know what is the best and safest file way to launch a file or application preferably not using exec?
Thank you
I would look at the documentation about child process. Here is the link if you would like it:
https://nodejs.org/dist/latest-v9.x/docs/api/child_process.html

Does node's exec call block meteor application?

I am building a meteor application that creates pdf files from a web page using phantomjs.
PhantomJS is called with node's child_process.exec function within a fiber using Meteor._wrapAsync. When I am using any url like google.com, it is working fine and the pdf is created.
The problem is, I want to capture a site served by the same meteor application at /invoicePDF. But during the execution of phantomjs the site apparently does not load, thus, it cannot load inside phantomjs, which makes finishing the call to phantomjs impossible.
The solution seemed to be to use Meteor.bindEnvironment instead of Meteor._wrapAsync. Unfortunately, I have know idea why.

How do I access a node.js script through a web browser?

I'm trying to use lesscss server side. It requires node.js for that, I've installed it and looked at some tutorials but now I have no idea how to use it. After you create a server/tcp or whatever how to you get to it from your website?
I wanna be able to do like mywebsite.com/css and when I go there it'll output the css that node.js tells it to.
What about this solution:
http://arguments.callee.info/2010/04/20/running-apache-and-node-js-together/

Resources