# Drive link checker v1

Extract IDs from pasted Google Drive, Docs, Sheets and Slides URLs locally.
The free MIT module uses the same code as the browser checker. It has no
network requests, file reads, dependencies or telemetry. Use modern JavaScript
or Node 18+. It cannot establish file existence, ownership, access or sharing.

Download [drive-link-checker.mjs](https://bulldo.gs/downloads/drive-link-checker.mjs),
then save this example beside it as `check.mjs` and run `node check.mjs`:

```js
import { checkDriveLinks } from './drive-link-checker.mjs';
console.log(checkDriveLinks([
  'https://drive.google.com/file/d/Demo_A/view',
  'https://drive.google.com/open?id=Demo_A',
  'https://example.com/unknown',
].join('\n')));
// checked: 3, issues: 2 (one repeated ID and one unsupported URL)
```

`checkDriveLinks(input)` returns `{ lines, checked, issues }`. `checked` counts
nonblank pasted lines, including unsupported URLs. `issues` counts each blank
line, unsupported URL and repeated occurrence after the first ID. Output includes
original 1-based line numbers and extracted IDs; it is a review report, not a
clean ID column. A repeated ID is not a duplicate file and no deletion is suggested.

Supported HTTPS URL forms use exact drive.google.com or docs.google.com hosts:
- `/file/d/ID` with optional `/view`, `/drive/folders/ID`, or `/open?id=ID` on Drive.
- `/document/d/ID`, `/spreadsheets/d/ID`, `/presentation/d/ID` on Docs, optionally
  followed by edit, view, preview, copy, present, pub or export.

IDs contain letters, digits, underscores or hyphens. Surrounding whitespace is
trimmed. Blank lines retain their references; one terminal newline is ignored.
CRLF/CR are normalized to newlines. Credentials, nondefault ports, deceptive
hosts, duplicate ID query parameters and path/query ID ambiguity are unsupported.
Other URL forms need manual review; unsupported does not mean nonexistent.
Maximum 100,000 characters and 500 lines; empty or oversized inputs throw errors.

Build: `node scripts/build-drive-link-checker.mjs`.
Parity: `node scripts/build-drive-link-checker.mjs --check`.
Source retrieval is distinct from an independently reported local run.

## License

MIT License

Copyright (c) 2026 QuasiLife

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
