File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1- const { Tunnel } = require ( "cloudflared" ) ;
1+ const fs = require ( "node:fs" ) ;
2+ const { Tunnel, bin, install } = require ( "cloudflared" ) ;
23
34console . log ( "Cloudflared Tunnel Example." ) ;
45main ( ) ;
56
67async function main ( ) {
8+ if ( ! fs . existsSync ( bin ) ) {
9+ // install cloudflared binary
10+ await install ( bin ) ;
11+ }
12+
713 // run: cloudflared tunnel --hello-world
814 const tunnel = Tunnel . quick ( ) ;
915
Original file line number Diff line number Diff line change 1- import { Tunnel } from "cloudflared" ;
1+ import fs from "node:fs" ;
2+ import { Tunnel , bin , install } from "cloudflared" ;
23
34console . log ( "Cloudflared Tunnel Example." ) ;
45main ( ) ;
56
67async function main ( ) {
8+ if ( ! fs . existsSync ( bin ) ) {
9+ // install cloudflared binary
10+ await install ( bin )
11+ }
12+
713 // run: cloudflared tunnel --hello-world
814 const tunnel = Tunnel . quick ( ) ;
915
You can’t perform that action at this time.
0 commit comments