aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchirvasitua <stuart-little@users.noreply.github.com>2021-04-12 17:44:06 -0400
committerchirvasitua <stuart-little@users.noreply.github.com>2021-04-12 17:44:06 -0400
commitdb14afe86bb3bf385cd725b216ae5a68f5812c69 (patch)
treed16156fed5da344b64b841f98e7cf1cb23e08d9b
parenteeb4cf0caad65ceee5fdddb161be04383ad53428 (diff)
downloadperlweeklychallenge-club-db14afe86bb3bf385cd725b216ae5a68f5812c69.tar.gz
perlweeklychallenge-club-db14afe86bb3bf385cd725b216ae5a68f5812c69.tar.bz2
perlweeklychallenge-club-db14afe86bb3bf385cd725b216ae5a68f5812c69.zip
1st commit on 108_node
-rwxr-xr-xchallenge-108/stuart-little/node/ch-1.js11
-rwxr-xr-xchallenge-108/stuart-little/node/ch-2.js5
2 files changed, 16 insertions, 0 deletions
diff --git a/challenge-108/stuart-little/node/ch-1.js b/challenge-108/stuart-little/node/ch-1.js
new file mode 100755
index 0000000000..baf649dc71
--- /dev/null
+++ b/challenge-108/stuart-little/node/ch-1.js
@@ -0,0 +1,11 @@
+#!/usr/bin/env node
+
+// run <script>
+// ref: https://github.com/node-ffi-napi/ref-napi
+
+let ref = require('ref-napi');
+let buf = Buffer.alloc(8);
+buf.writeInt32LE(5, 0);
+
+buf.type = ref.types.int;
+console.log(`The buffer buf holds the value ${buf.deref()} and its memory location is ${parseInt(buf.hexAddress(), 16)}.`);
diff --git a/challenge-108/stuart-little/node/ch-2.js b/challenge-108/stuart-little/node/ch-2.js
new file mode 100755
index 0000000000..950892dd96
--- /dev/null
+++ b/challenge-108/stuart-little/node/ch-2.js
@@ -0,0 +1,5 @@
+#!/usr/bin/env node
+
+// run <script>
+
+console.log("1, 1, 2, 5, 15, 52, 203, 877, 4140, 21147");