1.0.1 • Published 6 months ago

@jswork/check-resource v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

check-resource

Check resource exists.

version license size download

installation

yarn add @jswork/check-resource

usage

import checkResource from '@jswork/check-resource';

async function example() {
  // Check a valid resource
  const validUrl = 'https://web-assets.alo7.com/assets/text/hello.txt'; // Replace with a known existing URL
  const validExists = await checkResource(validUrl);
  console.log(`Does ${validUrl} exist? ${validExists}`); // Expected output: Does ... exist? true

  // Check an invalid resource
  const invalidUrl = 'https://web-assets.alo7.com/assets/text/not-exists.txt'; // Replace with a known non-existing URL
  const invalidExists = await checkResource(invalidUrl);
  console.log(`Does ${invalidUrl} exist? ${invalidExists}`); // Expected output: Does ... exist? false
}

example();

license

Code released under the MIT license.

1.0.1

6 months ago