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();
}

Libraries

os.file_system
Provides access to named pipes and other file system functions not provided by 'dart:io'.
os.loading
Helpers for loading dynamic libraries.
os.virtual_memory
Provides access to virtual memory functions.