GithubHelp home page GithubHelp logo

Comments (2)

cameel avatar cameel commented on June 5, 2024

No, there's no caching of any kind. loadRemoteVersion() is a very simple function that makes a HTTP request and stores the obtained binary in memory, without ever writing it to disk:

solc-js/wrapper.ts

Lines 43 to 69 in d6fee85

function loadRemoteVersion (versionString, callback) {
const memoryStream = new MemoryStream(null, { readable: false });
const url = `https://binaries.soliditylang.org/bin/soljson-${versionString}.js`;
https.get(url, response => {
if (response.statusCode !== 200) {
callback(new Error(`Error retrieving binary: ${response.statusMessage}`));
} else {
response.pipe(memoryStream);
response.on('end', () => {
// Based on the require-from-string package.
const soljson = new Module();
soljson._compile(memoryStream.toString(), `soljson-${versionString}.js`);
if (module.parent && module.parent.children) {
// Make sure the module is plugged into the hierarchy correctly to have parent
// properly garbage collected.
module.parent.children.splice(module.parent.children.indexOf(soljson), 1);
}
callback(null, wrapper(soljson.exports));
});
}
}).on('error', function (error) {
callback(error);
});
}

Each time you execute it, it will download the binary again.

If you want to load multiple versions and manage them in some way, you have do it on your own. The loaded binary as a JS module is passed to the callback you provide. Then you can do whatever you want with it.

Running solcjs --version, I only see the newest version available:

Yes, this returns only the version of the current binary. And by "current" I mean the one that is stored in soljson.js on disk. solcjs is a simple command-line wrapper that mimics the interface of native solc.

It never downloads the compiler, neither via loadRemoteVersion() or otherwise. Latest binary is always included in the npm package and if you're using the repo directly, you can use downloadCurrentVersion.ts to download that binary. solcjs works with only one version at at time but you can freely swap the file on disk for something else between invocations.

from solc-js.

alexreyes avatar alexreyes commented on June 5, 2024

Okay, thanks for the info! @cameel

from solc-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.