Git Product home page Git Product logo

large-go-func-test's Introduction

Large Go Functions on Netlify

An easy way to generate and test large Go functions on Netlify. Just follow the instructions and link your Netlify site to see the magic happen.

Generating Sizes

To generate large functions, we use a Makefile and a custom bash script (rand_replace_mb.sh) which takes the following paramaters:

  • Size of random text to generate (in megabytes)
  • Path to the function file
  • Placeholder in your function code to replace with the generated text

Note that the final size of the uploaded function may vary due to bundling/compression performed by Netlify (or the CLI) at build time. So, if you wish to play with the functions sizes, you can fork this repo and update the size of the random text generated in the Makefile.

Format:

    bash scripts/rand_replace_mb.sh <rand_text_size_in_megabytes> <path_to_function_file> <placeholder_text>

If you've linked your site and committed changes to your repo, Netlify will run the build script to generate the function before uploading.

To test this locally:

  • Ensure you have the latest version of the Netlify CLI installed
  • Run the netlify build command at the root of the project and you should be able to see random text replace the placeholder in the function.
  • You can use the du command to check the function size like so:
    • du -sh .netlify/functions/hello-world - uncompressed
    • du -sh .netlify/functions/hello-world.zip - compressed

Final Note

Although this was created specifically with Go in mind, it should work for JavaScript functions in a manner similar to the Go example in this project.

large-go-func-test's People

Contributors

karagulamos avatar

Watchers

 avatar

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.