Skip to content

Latest commit

 

History

History
68 lines (52 loc) · 1.8 KB

README.md

File metadata and controls

68 lines (52 loc) · 1.8 KB

Pub Package Github Actions CI Build Status

Overview

This package provides access to various low-level APIs of operating systems. The package binds with libc (Linux, Mac OS X) and kernel32.dll (Windows) using dart:ffi.

The project is licensed under the Apache License 2.0.

Status

Passes tests in:

  • Darwin (OS X)

Fails tests in:

  • Linux
  • Windows

Issues?

APIs

os.file_system

Library 'package:os/file_system.dart' provides access to various functions not supported by 'dart:io'.

Examples:

chmodSync(Directory("some/path"), 0x1FF); // Octal: 777

Named pipes (also known as "POSIX pipes") are sometimes used for inter-process communication in operating systems such as Linux and Mac OS X.

void main() async {
  // Create the pipe
  final namedPipe = NamedPipe("some/path");
  namedPipe.createSync();

  // Write something
  final writer = namedPipe.openWrite()
  writer.add([1,2,3])
  await writer.close();

  // Delete the pipe
  namedPipe.deleteSync();
}

os.virtual_memory

Library 'package:os/memory.dart' enables you to control virtual memory tables.

void main() async {
  // Allocate memory
  final memory = VirtualMemory.allocate(1024);

  // Set protection bits
  memory.setProtection(VirtualMemory.protectionReadWrite);

  // Write to the memory
  memory.asUint8List[23] = 29;

  // Free the memory
  memory.free();
}