Download pool/shard001/JavaScript/0006044_v8test.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 881 Bytes
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard001/JavaScript/0006044_v8test.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard001/JavaScript/0006044_v8test.js
-
curl -L -o 0006044_v8test.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard001/JavaScript/0006044_v8test.js
881 Bytes
| ; | |
| const Router = require('koa-router'); | |
| const koabody = require('koa-body')(); | |
| const fs = require('fs'); | |
| const profiler = require('v8-profiler'); | |
| profiler.startProfiling('', true); | |
| console.log('start') | |
| setTimeout(() => { | |
| console.log('stop'); | |
| let result = profiler.stopProfiling(''); | |
| fs.writeFileSync('./node.cpu.json', JSON.stringify(result)); | |
| result.delete(); | |
| }, 60 * 1000); | |
| let testTryCatch = (req, res) => { | |
| try { | |
| res.end('tryCatchStatement success!'); | |
| } catch (e) { | |
| res.end('tryCatchStatement ' + e.message); | |
| } | |
| } | |
| let testSleep = (req, res) => { | |
| const now = Date.now(); | |
| while (Date.now() - now < 200) {} | |
| res.end('testSleep success'); | |
| } | |
| let router = new Router(); | |
| router.get('/test', koabody, async (ctx, next) => { | |
| testTryCatch(ctx.req, ctx.res); | |
| testSleep(ctx.req, ctx.res); | |
| }) | |
| module.exports = router; |